Package org.apache.fontbox.ttf
Class RAFDataStream
java.lang.Object
org.apache.fontbox.ttf.TTFDataStream
org.apache.fontbox.ttf.RAFDataStream
- All Implemented Interfaces:
Closeable,AutoCloseable
An implementation of the TTFDataStream that goes against a RAF.
- Version:
- $Revision: 1.2 $
- Author:
- Ben Litchfield (ben@benlitchfield.com)
-
Constructor Summary
ConstructorsConstructorDescriptionRAFDataStream(File file, String mode) Constructor.RAFDataStream(String name, String mode) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the underlying resources.longGet the current position in the stream.This will get the original data file that was used for this stream.intread()Read an unsigned byte.intread(byte[] b, int off, int len) longreadLong()Read an unsigned byte.shortRead an signed short.intRead an unsigned short.voidseek(long pos) Seek into the datasource.Methods inherited from class org.apache.fontbox.ttf.TTFDataStream
read, read32Fixed, readInternationalDate, readSignedByte, readString, readString, readUnsignedByte, readUnsignedByteArray, readUnsignedInt, readUnsignedShortArray
-
Constructor Details
-
RAFDataStream
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:
-
RAFDataStream
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:
-
-
Method Details
-
readSignedShort
Read an signed short.- Specified by:
readSignedShortin classTTFDataStream- Returns:
- An signed short.
- Throws:
IOException- If there is an error reading the data.
-
getCurrentPosition
Get the current position in the stream.- Specified by:
getCurrentPositionin classTTFDataStream- Returns:
- The current position in the stream.
- Throws:
IOException- If an error occurs while reading the stream.
-
close
Close the underlying resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classTTFDataStream- Throws:
IOException- If there is an error closing the resources.
-
read
Read an unsigned byte.- Specified by:
readin classTTFDataStream- Returns:
- An unsigned byte.
- Throws:
IOException- If there is an error reading the data.
-
readUnsignedShort
Read an unsigned short.- Specified by:
readUnsignedShortin classTTFDataStream- Returns:
- An unsigned short.
- Throws:
IOException- If there is an error reading the data.
-
readLong
Read an unsigned byte.- Specified by:
readLongin classTTFDataStream- Returns:
- An unsigned byte.
- Throws:
IOException- If there is an error reading the data.
-
seek
Seek into the datasource.- Specified by:
seekin classTTFDataStream- Parameters:
pos- The position to seek to.- Throws:
IOException- If there is an error seeking to that position.
-
read
- Specified by:
readin classTTFDataStream- 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:
-
getOriginalData
This will get the original data file that was used for this stream.- Specified by:
getOriginalDatain classTTFDataStream- Returns:
- The data that was read from.
- Throws:
IOException- If there is an issue reading the data.
-