Class MemoryTTFDataStream
java.lang.Object
org.ofdrw.converter.font.TTFDataStream
org.ofdrw.converter.font.MemoryTTFDataStream
- All Implemented Interfaces:
Closeable, AutoCloseable
An interface into a data stream.
- Author:
- Ben Litchfield
-
Constructor Summary
Constructors -
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.longThis will get the original data size that was used for this stream.intread()Read an unsigned byte.intread(byte[] b, int off, int len) longreadLong()Read an unsigned byte.intRead a signed integer.shortRead an signed short.intRead an unsigned short.voidseek(long pos) Seek into the datasource.Methods inherited from class TTFDataStream
read, read32Fixed, readInternationalDate, readSignedByte, readString, readString, readString, readTag, readUnsignedByte, readUnsignedByteArray, readUnsignedInt, readUnsignedShortArrayModifier and TypeMethodDescriptionbyte[]read(int numberOfBytes) Read a specific number of bytes from the stream.floatRead a 16.16 fixed value, where the first 16 bits are the decimal and the last 16 bits are the fraction.Read an eight byte international date.intRead a signed byte.readString(int length) Read a fixed length ascii string.readString(int length, String charset) Read a fixed length string.readString(int length, Charset charset) Read a fixed length string.readTag()Reads a tag, an array of four uint8s used to identify a script, language system, feature, or baseline.intRead a unsigned byte.int[]readUnsignedByteArray(int length) Read an unsigned byte array.longRead an unsigned integer.int[]readUnsignedShortArray(int length) Read an unsigned short array.
-
Constructor Details
-
MemoryTTFDataStream
public MemoryTTFDataStream(byte[] data) 构造内存字体随机读取流- Parameters:
data- 字体数据
-
MemoryTTFDataStream
Constructor from a stream.- Parameters:
is- The stream to read from. It will be closed by this method.- Throws:
IOException- If an error occurs while reading from the stream.
-
-
Method Details
-
readLong
Read an unsigned byte.- Specified by:
readLongin classTTFDataStream- Returns:
- An unsigned byte.
- Throws:
IOException- If there is an error reading the data.
-
readSignedInt
Read a signed integer.- Returns:
- A signed integer.
- Throws:
IOException- If there is a problem reading the file.
-
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.
-
readSignedShort
Read an signed short.- Specified by:
readSignedShortin classTTFDataStream- Returns:
- An signed short.
- Throws:
IOException- If there is an error reading the data.
-
close
Close the underlying resources.- Throws:
IOException- If there is an error closing the resources.
-
seek
Seek into the datasource.- Specified by:
seekin classTTFDataStream- Parameters:
pos- The position to seek to.- Throws:
IOException- If the seek position is negative or larger than MAXINT.
-
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, or -1 at the end of the stream
- Throws:
IOException- If there is an error reading from the stream.- See Also:
-
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.
-
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.
-
getOriginalDataSize
public long getOriginalDataSize()This will get the original data size that was used for this stream.- Specified by:
getOriginalDataSizein classTTFDataStream- Returns:
- The size of the original data.
-