org.apache.fop.fonts.truetype
Class FontFileReader
java.lang.Object
org.apache.fop.fonts.truetype.FontFileReader
public class FontFileReader
extends java.lang.Object
Reads a TrueType font file into a byte array and
provides file like functions for array access.
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 | read() - Read 1 byte.
|
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.
|
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 | seekAdd(long add) - Set current file position to offset
|
void | seekSet(long offset) - Set current file position to offset
|
void | skip(long add) - Skip a given number of bytes.
|
void | writeTTFUShort(int pos, int val) - Write a USHort at a given position.
|
FontFileReader
public FontFileReader(InputStream in)
throws IOException
Constructor
in
- InputStream to read from
FontFileReader
public FontFileReader(String fileName)
throws IOException
Constructor
fileName
- filename to read
getBytes
public byte[] getBytes(int offset,
int length)
throws IOException
Return a copy of the internal array
offset
- The absolute offset to start reading fromlength
- The number of bytes to read
getCurrentPos
public int getCurrentPos()
Returns current file position.
- int The current position.
getFileSize
public int getFileSize()
Returns the size of the file.
read
public byte read()
throws IOException
Read 1 byte.
readTTFByte
public final byte readTTFByte()
throws IOException
Read 1 signed byte.
readTTFLong
public final int readTTFLong()
throws IOException
Read 4 bytes.
readTTFShort
public final short readTTFShort()
throws IOException
Read 2 bytes signed.
readTTFShort
public final short readTTFShort(long pos)
throws IOException
Read 2 bytes signed at position pos without changing current position.
pos
- The absolute position to read from
readTTFString
public final String readTTFString()
throws IOException
Read a NUL terminated ISO-8859-1 string.
readTTFString
public final String readTTFString(int len)
throws IOException
Read an ISO-8859-1 string of len bytes.
len
- The length of the string to read
readTTFUByte
public final int readTTFUByte()
throws IOException
Read 1 unsigned byte.
readTTFULong
public final long readTTFULong()
throws IOException
Read 4 bytes.
readTTFUShort
public final int readTTFUShort()
throws IOException
Read 2 bytes unsigned.
readTTFUShort
public final int readTTFUShort(long pos)
throws IOException
Read 2 bytes unsigned at position pos without changing current position.
pos
- The absolute position to read from
seekAdd
public void seekAdd(long add)
throws IOException
Set current file position to offset
add
- The number of bytes to advance
seekSet
public void seekSet(long offset)
throws IOException
Set current file position to offset
offset
- The new offset to set
skip
public void skip(long add)
throws IOException
Skip a given number of bytes.
add
- The number of bytes to advance
writeTTFUShort
public final void writeTTFUShort(int pos,
int val)
throws IOException
Write a USHort at a given position.
pos
- The absolute position to write toval
- The value to write
Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.