org.apache.fop.fonts
Class FontFileReader

java.lang.Object
  extended by org.apache.fop.fonts.FontFileReader

public class FontFileReader
extends Object

Reads a file into an array and provides file like functions for array access.


Constructor Summary
FontFileReader(InputStream in)
          Constructor
FontFileReader(String fileName)
          Constructor
 
Method Summary
 byte[] getBytes(int offset, int length)
          Return a copy of the internal array
 int getCurrentPos()
          return current file position
 int getFileSize()
           
 byte read()
          Read 1 byte, throws EOFException on end of file
 byte readTTFByte()
          Read 1 signed byte from InputStream
 int readTTFLong()
          Read 4 bytes from InputStream
 short readTTFShort()
          Read 2 bytes signed from InputStream
 short readTTFShort(long pos)
          Read 2 bytes signed from InputStream at position pos without changing current position
 String readTTFString()
          Read a 0 terminatet ISO-8859-1 string
 String readTTFString(int len)
          Read an ISO-8859-1 string of len bytes
 int readTTFUByte()
          Read 1 unsigned byte from InputStream
 long readTTFULong()
          Read 4 bytes from InputStream
 int readTTFUShort()
          Read 2 bytes unsigned from InputStream
 int readTTFUShort(long pos)
          Read 2 bytes unsigned from InputStream at position pos without changing current position
 void seek_add(long add)
          Set current file position to offset
 void seek_set(long offset)
          Set current file position to offset
 void skip(long add)
           
 void writeTTFUShort(int pos, int val)
          Write a USHort at a given position
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FontFileReader

public FontFileReader(String fileName)
               throws IOException
Constructor

Parameters:
fileName - filename to read
Throws:
IOException

FontFileReader

public FontFileReader(InputStream in)
               throws IOException
Constructor

Parameters:
in - InputStream to read from
Throws:
IOException
Method Detail

seek_set

public void seek_set(long offset)
              throws IOException
Set current file position to offset

Throws:
IOException

seek_add

public void seek_add(long add)
              throws IOException
Set current file position to offset

Throws:
IOException

skip

public void skip(long add)
          throws IOException
Throws:
IOException

getCurrentPos

public int getCurrentPos()
return current file position


getFileSize

public int getFileSize()

read

public byte read()
          throws IOException
Read 1 byte, throws EOFException on end of file

Throws:
IOException

readTTFByte

public final byte readTTFByte()
                       throws IOException
Read 1 signed byte from InputStream

Throws:
IOException

readTTFUByte

public final int readTTFUByte()
                       throws IOException
Read 1 unsigned byte from InputStream

Throws:
IOException

readTTFShort

public final short readTTFShort()
                         throws IOException
Read 2 bytes signed from InputStream

Throws:
IOException

readTTFUShort

public final int readTTFUShort()
                        throws IOException
Read 2 bytes unsigned from InputStream

Throws:
IOException

writeTTFUShort

public final void writeTTFUShort(int pos,
                                 int val)
                          throws IOException
Write a USHort at a given position

Throws:
IOException

readTTFShort

public final short readTTFShort(long pos)
                         throws IOException
Read 2 bytes signed from InputStream at position pos without changing current position

Throws:
IOException

readTTFUShort

public final int readTTFUShort(long pos)
                        throws IOException
Read 2 bytes unsigned from InputStream at position pos without changing current position

Throws:
IOException

readTTFLong

public final int readTTFLong()
                      throws IOException
Read 4 bytes from InputStream

Throws:
IOException

readTTFULong

public final long readTTFULong()
                        throws IOException
Read 4 bytes from InputStream

Throws:
IOException

readTTFString

public final String readTTFString()
                           throws IOException
Read a 0 terminatet ISO-8859-1 string

Throws:
IOException

readTTFString

public final String readTTFString(int len)
                           throws IOException
Read an ISO-8859-1 string of len bytes

Throws:
IOException

getBytes

public byte[] getBytes(int offset,
                       int length)
                throws IOException
Return a copy of the internal array

Throws:
IOException - if out of bounds


Copyright ? 1999-2003 Apache Software Foundation. All Rights Reserved.