org.apache.fontbox.ttf
Class MemoryTTFDataStream

java.lang.Object
  extended by org.apache.fontbox.ttf.TTFDataStream
      extended by org.apache.fontbox.ttf.MemoryTTFDataStream

public class MemoryTTFDataStream
extends TTFDataStream

An interface into a data stream.

Version:
$Revision: 1.2 $
Author:
Ben Litchfield (ben@benlitchfield.com)

Constructor Summary
MemoryTTFDataStream(java.io.InputStream is)
          Constructor from a stream.
 
Method Summary
 void close()
          Close the underlying resources.
 long getCurrentPosition()
          Get the current position in the stream.
 java.io.InputStream getOriginalData()
          This will get the original data file that was used for this stream.
 int read()
          Read an unsigned byte.
 int read(byte[] b, int off, int len)
           
 long readLong()
          Read an unsigned byte.
 int readSignedInt()
          Read a signed integer.
 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.apache.fontbox.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

MemoryTTFDataStream

public MemoryTTFDataStream(java.io.InputStream is)
                    throws java.io.IOException
Constructor from a stream.

Parameters:
is - The stream of read from.
Throws:
java.io.IOException - If an error occurs while reading from the stream.
Method Detail

readLong

public long readLong()
              throws java.io.IOException
Read an unsigned byte.

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

readSignedInt

public int readSignedInt()
                  throws java.io.IOException
Read a signed integer.

Returns:
A signed integer.
Throws:
java.io.IOException - If there is a problem reading the file.

read

public int read()
         throws java.io.IOException
Read an unsigned byte.

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

readUnsignedShort

public int readUnsignedShort()
                      throws java.io.IOException
Read an unsigned short.

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

readSignedShort

public short readSignedShort()
                      throws java.io.IOException
Read an signed short.

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

close

public void close()
           throws java.io.IOException
Close the underlying resources.

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

seek

public void seek(long pos)
          throws java.io.IOException
Seek into the datasource.

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

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.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:
java.io.IOException - If there is an error reading from the stream.
See Also:
InputStream.read( byte[], int, int )

getCurrentPosition

public long getCurrentPosition()
                        throws java.io.IOException
Get the current position in the stream.

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

getOriginalData

public java.io.InputStream getOriginalData()
                                    throws java.io.IOException
This will get the original data file that was used for this stream.

Specified by:
getOriginalData in class TTFDataStream
Returns:
The data that was read from.
Throws:
java.io.IOException - If there is an issue reading the data.


Copyright © 2008-2011 Apache Software Foundation. All Rights Reserved.