public class ReadableFontData extends FontData
The data types used are as listed:
BYTE | 8-bit unsigned integer. |
CHAR | 8-bit signed integer. |
USHORT | 16-bit unsigned integer. |
SHORT | 16-bit signed integer. |
UINT24 | 24-bit unsigned integer. |
ULONG | 32-bit unsigned integer. |
LONG | 32-bit signed integer. |
Fixed | 32-bit signed fixed-point number (16.16) |
FUNIT | Smallest measurable distance in the em space. |
FWORD | 16-bit signed integer (SHORT) that describes a quantity in FUnits. |
UFWORD | 16-bit unsigned integer (USHORT) that describes a quantity in FUnits. |
F2DOT14 | 16-bit signed fixed number with the low 14 bits of fraction (2.14). |
LONGDATETIME | Date represented in number of seconds since 12:00 midnight, January 1, 1904. The value is represented as a signed 64-bit integer. |
WritableFontData
FontData.DataSize
Modifier and Type | Method and Description |
---|---|
long |
checksum()
Gets a computed checksum for the data.
|
int[] |
checkSumRange()
Gets the ranges that are used for computing the checksum.
|
int |
copyTo(java.io.OutputStream os)
Copy the FontData to an OutputStream.
|
int |
copyTo(WritableFontData wfd)
Copies the FontData to a WritableFontData.
|
static ReadableFontData |
createReadableFontData(byte[] b) |
int |
readByte(int index)
Reads the BYTE at the given index.
|
int |
readBytes(int index,
byte[] b,
int offset,
int length)
Reads the bytes at the given index into the array.
|
int |
readChar(int index)
Reads the CHAR at the given index.
|
long |
readDateTimeAsLong(int index)
Reads the LONGDATETIME at the given index.
|
java.math.BigDecimal |
readF2Dot14(int index)
Reads the F2DOT14 at the given index.
|
int |
readFixed(int index)
Reads the Fixed at the given index.
|
int |
readFUnit(int index)
Reads the FUNIT at the given index.
|
int |
readFWord(int index)
Reads the FWORD at the given index.
|
int |
readLong(int index)
Reads the LONG at the given index.
|
java.util.Date |
readLongDateTime(int index)
Reads the LONGDATETIME at the given index.
|
int |
readShort(int index)
Reads the SHORT at the given index.
|
int |
readUByte(int index)
Reads the UBYTE at the given index.
|
int |
readUFWord(int index)
Reads the UFWORD at the given index.
|
int |
readUInt24(int index)
Reads the UINT24 at the given index.
|
long |
readULong(int index)
Reads the ULONG at the given index.
|
int |
readULongAsInt(int index)
Reads the ULONG at the given index as an int.
|
long |
readULongLE(int index)
Reads the ULONG at the given index, little-endian variant.
|
int |
readUShort(int index)
Reads the USHORT at the given index.
|
int |
searchULong(int startIndex,
int startOffset,
int endIndex,
int endOffset,
int length,
int key)
Search for the key value in the range tables provided.
|
int |
searchUShort(int startIndex,
int startOffset,
int length,
int key)
Search for the key value in the table provided.
|
int |
searchUShort(int startIndex,
int startOffset,
int endIndex,
int endOffset,
int length,
int key)
Search for the key value in the range tables provided.
|
void |
setCheckSumRanges(int... ranges)
Sets the ranges to use for computing the checksum.
|
ReadableFontData |
slice(int offset)
Makes a bottom bound only slice of this array.
|
ReadableFontData |
slice(int offset,
int length)
Makes a slice of this FontData.
|
java.lang.String |
toString() |
java.lang.String |
toString(int length)
Generates a String representation of the object with a certain number of
data bytes.
|
public static ReadableFontData createReadableFontData(byte[] b)
public ReadableFontData slice(int offset, int length)
FontData
.public ReadableFontData slice(int offset)
FontData
.public java.lang.String toString(int length)
length
- number of bytes of the data to include in the Stringpublic java.lang.String toString()
toString
in class java.lang.Object
public long checksum()
public void setCheckSumRanges(int... ranges)
ranges
- the range bounds to use for the checksumpublic int[] checkSumRange()
public int readUByte(int index)
index
- index into the font datajava.lang.IndexOutOfBoundsException
- if index is outside the FontData's rangepublic int readByte(int index)
index
- index into the font datajava.lang.IndexOutOfBoundsException
- if index is outside the FontData's rangepublic int readBytes(int index, byte[] b, int offset, int length)
index
- index into the font datab
- the destination for the bytes readoffset
- offset in the byte array to place the byteslength
- the length of bytes to readpublic int readChar(int index)
index
- index into the font datajava.lang.IndexOutOfBoundsException
- if index is outside the FontData's rangepublic int readUShort(int index)
index
- index into the font datajava.lang.IndexOutOfBoundsException
- if index is outside the FontData's rangepublic int readShort(int index)
index
- index into the font datajava.lang.IndexOutOfBoundsException
- if index is outside the FontData's rangepublic int readUInt24(int index)
index
- index into the font datajava.lang.IndexOutOfBoundsException
- if index is outside the FontData's rangepublic long readULong(int index)
index
- index into the font datajava.lang.IndexOutOfBoundsException
- if index is outside the FontData's rangepublic int readULongAsInt(int index)
index
- index into the font datajava.lang.IndexOutOfBoundsException
- if index is outside the FontData's rangejava.lang.ArithmeticException
- if the value will not fit into an integerpublic long readULongLE(int index)
index
- index into the font datajava.lang.IndexOutOfBoundsException
- if index is outside the FontData's rangepublic int readLong(int index)
index
- index into the font datajava.lang.IndexOutOfBoundsException
- if index is outside the FontData's rangepublic int readFixed(int index)
index
- index into the font datajava.lang.IndexOutOfBoundsException
- if index is outside the FontData's rangepublic java.math.BigDecimal readF2Dot14(int index)
index
- index into the font datajava.lang.IndexOutOfBoundsException
- if index is outside the FontData's rangepublic long readDateTimeAsLong(int index)
index
- index into the font datajava.lang.IndexOutOfBoundsException
- if index is outside the FontData's rangepublic java.util.Date readLongDateTime(int index)
index
- index into the font datajava.lang.IndexOutOfBoundsException
- if index is outside the FontData's rangepublic int readFUnit(int index)
index
- index into the font datajava.lang.IndexOutOfBoundsException
- if index is outside the FontData's rangepublic int readFWord(int index)
index
- index into the font datajava.lang.IndexOutOfBoundsException
- if index is outside the FontData's rangepublic int readUFWord(int index)
index
- index into the font datajava.lang.IndexOutOfBoundsException
- if index is outside the FontData's rangepublic int copyTo(java.io.OutputStream os) throws java.io.IOException
os
- the destinationjava.io.IOException
public int copyTo(WritableFontData wfd)
wfd
- the destinationpublic int searchUShort(int startIndex, int startOffset, int endIndex, int endOffset, int length, int key)
startIndex
- the position to read the first start value fromstartOffset
- the offset between subsequent start valuesendIndex
- the position to read the first end value fromendOffset
- the offset between subsequent end valueslength
- the number of start-end pairskey
- the value to search forpublic int searchULong(int startIndex, int startOffset, int endIndex, int endOffset, int length, int key)
startIndex
- the position to read the first start value fromstartOffset
- the offset between subsequent start valuesendIndex
- the position to read the first end value fromendOffset
- the offset between subsequent end valueslength
- the number of start-end pairskey
- the value to search forpublic int searchUShort(int startIndex, int startOffset, int length, int key)
startIndex
- the position to read the first start value fromstartOffset
- the offset between subsequent start valueslength
- the number of start-end pairskey
- the value to search for