Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.pdfbox.ttf
Class TTFDataStream

    java.lang.Object
      org.pdfbox.ttf.TTFDataStream

Direct Known Subclasses:
  MemoryTTFDataStream, RAFDataStream

public abstract class TTFDataStream
extends Object

An interface into a data stream.

Version:
  $Revision: 1.3 $
Author:
  Ben Litchfield (ben@csh.rit.edu)

Constructor Summary
`TTFDataStream()`

Method Summary
`abstract void` | `close()` Close the underlying resources.
`abstract COSStream` | `getCOSStream()` Get a COSStream from this TTFDataStream This permit to pass the data read from an external source to the COSObjects to keep a certain persistence layer between specialized objects like the TTF package and the pdmodel package.
`abstract long` | `getCurrentPosition()` Get the current position in the stream.
`abstract int` | `read()` Read an unsigned byte.
`abstract int` | `read(byte[] b, int off, int len)`
`byte[]` | `read(int numberOfBytes)` Read a specific number of bytes from the stream.
`float` | `read32Fixed()` Read a 16.16 fixed value, where the first 16 bits are the decimal and the last 16 bits are the fraction.
`Calendar` | `readInternationalDate()` Read an eight byte international date.
`abstract long` | `readLong()` Read an unsigned byte.
`int` | `readSignedByte()` Read an unsigned byte.
`abstract short` | `readSignedShort()` Read an signed short.
`String` | `readString(int length)` Read a fixed length ascii string.
`String` | `readString(int length, String charset)` Read a fixed length ascii string.
`long` | `readUnsignedInt()` Read an unsigned integer.
`abstract int` | `readUnsignedShort()` Read an unsigned short.
`int[]` | `readUnsignedShortArray(int length)` Read an unsigned short array.
`abstract void` | `seek(long pos)` Seek into the datasource.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TTFDataStream

    public TTFDataStream()

Method Detail

### read32Fixed

    public float read32Fixed()
                      throws IOException

  Read a 16.16 fixed value, where the first 16 bits are the decimal and the last 16 bits are the fraction.

  Returns:
    A 32 bit value.
  Throws:
    `IOException` - If there is an error reading the data.

### readString

    public String readString(int length)
                      throws IOException

  Read a fixed length ascii string.

  Parameters:
    `length` - The length of the string to read.
  Returns:
    A string of the desired length.
  Throws:
    `IOException` - If there is an error reading the data.

### readString

    public String readString(int length,
                             String charset)
                      throws IOException

  Read a fixed length ascii string.

  Parameters:
    `length` - The length of the string to read in bytes.
    `charset` - The expected character set of the string.
  Returns:
    A string of the desired length.
  Throws:
    `IOException` - If there is an error reading the data.

### read

    public abstract int read()
                      throws IOException

  Read an unsigned byte.

  Returns:
    An unsigned byte.
  Throws:
    `IOException` - If there is an error reading the data.

### readLong

    public abstract long readLong()
                           throws IOException

  Read an unsigned byte.

  Returns:
    An unsigned byte.
  Throws:
    `IOException` - If there is an error reading the data.

### readSignedByte

    public int readSignedByte()
                       throws IOException

  Read an unsigned byte.

  Returns:
    An unsigned byte.
  Throws:
    `IOException` - If there is an error reading the data.

### readUnsignedInt

    public long readUnsignedInt()
                         throws IOException

  Read an unsigned integer.

  Returns:
    An unsiged integer.
  Throws:
    `IOException` - If there is an error reading the data.

### readUnsignedShort

    public abstract int readUnsignedShort()
                                   throws IOException

  Read an unsigned short.

  Returns:
    An unsigned short.
  Throws:
    `IOException` - If there is an error reading the data.

### readUnsignedShortArray

    public int[] readUnsignedShortArray(int length)
                                 throws IOException

  Read an unsigned short array.

  Parameters:
    `length` - The length of the array to read.
  Returns:
    An unsigned short array.
  Throws:
    `IOException` - If there is an error reading the data.

### readSignedShort

    public abstract short readSignedShort()
                                   throws IOException

  Read an signed short.

  Returns:
    An signed short.
  Throws:
    `IOException` - If there is an error reading the data.

### readInternationalDate

    public Calendar readInternationalDate()
                                   throws IOException

  Read an eight byte international date.

  Returns:
    An signed short.
  Throws:
    `IOException` - If there is an error reading the data.

### close

    public abstract void close()
                        throws IOException

  Close the underlying resources.

  Throws:
    `IOException` - If there is an error closing the resources.

### seek

    public abstract void seek(long pos)
                       throws IOException

  Seek into the datasource.

  Parameters:
    `pos` - The position to seek to.
  Throws:
    `IOException` - If there is an error seeking to that position.

### read

    public byte[] read(int numberOfBytes)
                throws IOException

  Read a specific number of bytes from the stream.

  Parameters:
    `numberOfBytes` - The number of bytes to read.
  Returns:
    The byte buffer.
  Throws:
    `IOException` - If there is an error while reading.

### read

    public abstract int read(byte[] b,
                             int off,
                             int len)
                      throws IOException

  Parameters:
    `b` - The buffer to write to.
    `off` - The offset into the buffer.
    `len` - The length into the buffer.
  Returns:
    The number of bytes read.
  Throws:
    `IOException` - If there is an error reading from the stream.
  See Also:
    `InputStream.read( byte[], int, int )`

### getCurrentPosition

    public abstract long getCurrentPosition()
                                     throws IOException

  Get the current position in the stream.

  Returns:
    The current position in the stream.
  Throws:
    `IOException` - If an error occurs while reading the stream.

### getCOSStream

    public abstract COSStream getCOSStream()

  Get a COSStream from this TTFDataStream This permit to pass the data read from an external source to the COSObjects to keep a certain persistence layer between specialized objects like the TTF package and the pdmodel package. Created by Pascal Allain Vertical7 Inc.

  Returns:
    COSStream describing this stream

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD