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 RAFDataStream

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

public class RAFDataStream
extends TTFDataStream

An implementation of the TTFDataStream that goes against a RAF.

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

Constructor Summary
`RAFDataStream(File file, String mode)` Constructor.
`RAFDataStream(String name, String mode)` Constructor.

Method Summary
`void` | `close()` Close the underlying resources.
`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.
`long` | `getCurrentPosition()` Get the current position in the stream.
`int` | `read()` Read an unsigned byte.
`int` | `read(byte[] b, int off, int len)`
`long` | `readLong()` Read an unsigned byte.
`short` | `readSignedShort()` Read an signed short.
`int` | `readUnsignedShort()` Read an unsigned short.
`void` | `seek(long pos)` Seek into the datasource.

Methods inherited from class org.pdfbox.ttf.TTFDataStream
`read, read32Fixed, readInternationalDate, readSignedByte, readString, readString, readUnsignedInt, readUnsignedShortArray`

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

Constructor Detail

### RAFDataStream

    public RAFDataStream(String name,
                         String mode)
                  throws FileNotFoundException

  Constructor.

Parameters:
  `name` - The raf file.
  `mode` - The mode to open the RAF.
Throws:
  `FileNotFoundException` - If there is a problem creating the RAF.
See Also:
  `RandomAccessFile.RandomAccessFile( String, String )`

### RAFDataStream

    public RAFDataStream(File file,
                         String mode)
                  throws FileNotFoundException

  Constructor.

Parameters:
  `file` - The raf file.
  `mode` - The mode to open the RAF.
Throws:
  `FileNotFoundException` - If there is a problem creating the RAF.
See Also:
  `RandomAccessFile.RandomAccessFile( File, String )`

Method Detail

### readSignedShort

    public short readSignedShort()
                          throws IOException

  Read an signed short.

  Specified by:
    `readSignedShort` in class `TTFDataStream`
  Returns:
    An signed short.
  Throws:
    `IOException` - If there is an error reading the data.

### getCurrentPosition

    public long getCurrentPosition()
                            throws IOException

  Get the current position in the stream.

  Specified by:
    `getCurrentPosition` in class `TTFDataStream`
  Returns:
    The current position in the stream.
  Throws:
    `IOException` - If an error occurs while reading the stream.

### getCOSStream

    public 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.

  Specified by:
    `getCOSStream` in class `TTFDataStream`
  Returns:
    COSStream describing this stream (unfiletred)

### close

    public void close()
               throws IOException

  Close the underlying resources.

  Specified by:
    `close` in class `TTFDataStream`
  Throws:
    `IOException` - If there is an error closing the resources.

### read

    public int read()
             throws IOException

  Read an unsigned byte.

  Specified by:
    `read` in class `TTFDataStream`
  Returns:
    An unsigned byte.
  Throws:
    `IOException` - If there is an error reading the data.

### readUnsignedShort

    public int readUnsignedShort()
                          throws IOException

  Read an unsigned short.

  Specified by:
    `readUnsignedShort` in class `TTFDataStream`
  Returns:
    An unsigned short.
  Throws:
    `IOException` - If there is an error reading the data.

### readLong

    public long readLong()
                  throws IOException

  Read an unsigned byte.

  Specified by:
    `readLong` in class `TTFDataStream`
  Returns:
    An unsigned byte.
  Throws:
    `IOException` - If there is an error reading the data.

### seek

    public void seek(long pos)
              throws IOException

  Seek into the datasource.

  Specified by:
    `seek` in class `TTFDataStream`
  Parameters:
    `pos` - The position to seek to.
  Throws:
    `IOException` - If there is an error seeking to that position.

### read

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

  Specified by:
    `read` in class `TTFDataStream`
  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 )`

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