org.apache.fontbox.ttf

Class RAFDataStream

public class RAFDataStream extends TTFDataStream

An implementation of the TTFDataStream that goes against a RAF.

Version: $Revision: 1.2 $

Author: Ben Litchfield (ben@benlitchfield.com)

Constructor Summary
RAFDataStream(String name, String mode)
Constructor.
RAFDataStream(File file, String mode)
Constructor.
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.
shortreadSignedShort()
Read an signed short.
intreadUnsignedShort()
Read an unsigned short.
voidseek(long pos)
Seek into the datasource.

Constructor Detail

RAFDataStream

public RAFDataStream(String name, String mode)
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)
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

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.

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-2011 Apache Software Foundation. All Rights Reserved.