public class FontFileReader
extends java.lang.Object
Constructor and Description |
---|
FontFileReader(java.io.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.
|
java.lang.String |
readTTFString()
Read a NUL terminated ISO-8859-1 string.
|
java.lang.String |
readTTFString(int len)
Read an ISO-8859-1 string of len bytes.
|
java.lang.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(java.io.InputStream in) throws java.io.IOException
in
- InputStream to read fromjava.io.IOException
- In case of an I/O problempublic void seekSet(long offset) throws java.io.IOException
offset
- The new offset to setjava.io.IOException
- In case of an I/O problempublic void skip(long add) throws java.io.IOException
add
- The number of bytes to advancejava.io.IOException
- In case of an I/O problempublic int getCurrentPos()
public int getFileSize()
public final byte readTTFByte() throws java.io.IOException
java.io.IOException
- If EOF is reachedpublic final int readTTFUByte() throws java.io.IOException
java.io.IOException
- If EOF is reachedpublic final short readTTFShort() throws java.io.IOException
java.io.IOException
- If EOF is reachedpublic final int readTTFUShort() throws java.io.IOException
java.io.IOException
- If EOF is reachedpublic final void writeTTFUShort(long pos, int val) throws java.io.IOException
pos
- The absolute position to write toval
- The value to writejava.io.IOException
- If EOF is reachedpublic final short readTTFShort(long pos) throws java.io.IOException
pos
- The absolute position to read fromjava.io.IOException
- If EOF is reachedpublic final int readTTFUShort(long pos) throws java.io.IOException
pos
- The absolute position to read fromjava.io.IOException
- If EOF is reachedpublic final int readTTFLong() throws java.io.IOException
java.io.IOException
- If EOF is reachedpublic final long readTTFULong() throws java.io.IOException
java.io.IOException
- If EOF is reachedpublic final java.lang.String readTTFString() throws java.io.IOException
java.io.IOException
- If EOF is reachedpublic final java.lang.String readTTFString(int len) throws java.io.IOException
len
- The length of the string to readjava.io.IOException
- If EOF is reachedpublic final java.lang.String readTTFString(int len, int encodingID) throws java.io.IOException
len
- The length of the string to readencodingID
- the string encoding id (presently ignored; always uses UTF-16BE)java.io.IOException
- If EOF is reachedpublic byte[] getBytes(int offset, int length) throws java.io.IOException
offset
- The absolute offset to start reading fromlength
- The number of bytes to readjava.io.IOException
- if out of boundspublic byte[] getAllBytes()
Copyright 1999-2017 The Apache Software Foundation. All Rights Reserved.