org.apache.fontbox.ttf

Class 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(InputStream is)
Constructor from a stream.
Method Summary
voidclose()
Close the underlying resources.
longgetCurrentPosition()
Get the current position in the stream.
InputStreamgetOriginalData()
intread()
Read an unsigned byte.
intread(byte[] b, int off, int len)
longreadLong()
Read an unsigned byte.
intreadSignedInt()
Read a signed integer.
shortreadSignedShort()
Read an signed short.
intreadUnsignedShort()
Read an unsigned short.
voidseek(long pos)
Seek into the datasource.

Constructor Detail

MemoryTTFDataStream

public MemoryTTFDataStream(InputStream is)
Constructor from a stream.

Parameters: is The stream of read from.

Throws: IOException If an error occurs while reading from the stream.

Method Detail

close

public void close()
Close the underlying resources.

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

getCurrentPosition

public long getCurrentPosition()
Get the current position in the stream.

Returns: The current position in the stream.

Throws: IOException If an error occurs while reading the stream.

getOriginalData

public InputStream getOriginalData()
{@inheritDoc }

read

public int read()
Read an unsigned byte.

Returns: An unsigned byte.

Throws: IOException If there is an error reading the data.

read

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

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: java.io.InputStream#read( byte[], int, int )

readLong

public long readLong()
Read an unsigned byte.

Returns: An unsigned byte.

Throws: IOException If there is an error reading the data.

readSignedInt

public int readSignedInt()
Read a signed integer.

Returns: A signed integer.

Throws: IOException If there is a problem reading the file.

readSignedShort

public short readSignedShort()
Read an signed short.

Returns: An signed short.

Throws: IOException If there is an error reading the data.

readUnsignedShort

public int readUnsignedShort()
Read an unsigned short.

Returns: An unsigned short.

Throws: IOException If there is an error reading the data.

seek

public void seek(long pos)
Seek into the datasource.

Parameters: pos The position to seek to.

Throws: IOException If there is an error seeking to that position.

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