public class FontFileReader extends Object
| Constructor and Description |
|---|
FontFileReader(InputStream in)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getAllBytes()
Returns the full byte array representation of the file.
|
byte[] |
getBytes(int offset,
int length)
Return a copy of the internal array
|
int |
getCurrentPos()
Returns current file position.
|
int |
getFileSize()
Returns the size of the file.
|
byte |
readTTFByte()
Read 1 signed byte.
|
int |
readTTFLong()
Read 4 bytes.
|
short |
readTTFShort()
Read 2 bytes signed.
|
short |
readTTFShort(long pos)
Read 2 bytes signed at position pos without changing current position.
|
String |
readTTFString()
Read a NUL terminated ISO-8859-1 string.
|
String |
readTTFString(int len)
Read an ISO-8859-1 string of len bytes.
|
String |
readTTFString(int len,
int encodingID)
Read an ISO-8859-1 string of len bytes.
|
int |
readTTFUByte()
Read 1 unsigned byte.
|
long |
readTTFULong()
Read 4 bytes.
|
int |
readTTFUShort()
Read 2 bytes unsigned.
|
int |
readTTFUShort(long pos)
Read 2 bytes unsigned at position pos without changing current position.
|
void |
seekSet(long offset)
Set current file position to offset
|
void |
skip(long add)
Skip a given number of bytes.
|
void |
writeTTFUShort(long pos,
int val)
Write a USHort at a given position.
|
public FontFileReader(InputStream in) throws IOException
in - InputStream to read fromIOException - In case of an I/O problempublic void seekSet(long offset)
throws IOException
offset - The new offset to setIOException - In case of an I/O problempublic void skip(long add)
throws IOException
add - The number of bytes to advanceIOException - In case of an I/O problempublic int getCurrentPos()
public int getFileSize()
public final byte readTTFByte()
throws IOException
IOException - If EOF is reachedpublic final int readTTFUByte()
throws IOException
IOException - If EOF is reachedpublic final short readTTFShort()
throws IOException
IOException - If EOF is reachedpublic final int readTTFUShort()
throws IOException
IOException - If EOF is reachedpublic final void writeTTFUShort(long pos,
int val)
throws IOException
pos - The absolute position to write toval - The value to writeIOException - If EOF is reachedpublic final short readTTFShort(long pos)
throws IOException
pos - The absolute position to read fromIOException - If EOF is reachedpublic final int readTTFUShort(long pos)
throws IOException
pos - The absolute position to read fromIOException - If EOF is reachedpublic final int readTTFLong()
throws IOException
IOException - If EOF is reachedpublic final long readTTFULong()
throws IOException
IOException - If EOF is reachedpublic final String readTTFString() throws IOException
IOException - If EOF is reachedpublic final String readTTFString(int len) throws IOException
len - The length of the string to readIOException - If EOF is reachedpublic final String readTTFString(int len, int encodingID) throws IOException
len - The length of the string to readencodingID - the string encoding id (presently ignored; always uses UTF-16BE)IOException - If EOF is reachedpublic byte[] getBytes(int offset,
int length)
throws IOException
offset - The absolute offset to start reading fromlength - The number of bytes to readIOException - if out of boundspublic byte[] getAllBytes()
Copyright © 2025 Apache Software Foundation. All rights reserved.