Package org.apache.fontbox.pfb
Class PfbParser
- java.lang.Object
-
- org.apache.fontbox.pfb.PfbParser
-
public class PfbParser extends java.lang.ObjectParser for a pfb-file.
-
-
Field Summary
Fields Modifier and Type Field Description private static intASCII_MARKERthe ascii marker.private static intBINARY_MARKERthe binary marker.private static intBUFFER_SIZEbuffersize.private static intEOF_MARKERthe EOF marker.private int[]lengthsthe lengths of the records (ASCII, BINARY, ASCII)private static org.apache.commons.logging.LogLOGprivate static intPFB_HEADER_LENGTHthe pfb header length.private byte[]pfbdatathe parsed pfb-data.private static intSTART_MARKERthe start marker.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.InputStreamgetInputStream()Returns the pfb data as stream.int[]getLengths()Returns the lengths.byte[]getPfbdata()Returns the pfbdata.byte[]getSegment1()Returns the first segmentbyte[]getSegment2()Returns the second segmentprivate voidparsePfb(byte[] pfb)Parse the pfb-array.private byte[]readFully(java.io.InputStream in)Read the pfb input.intsize()Returns the size of the pfb-data.
-
-
-
Field Detail
-
LOG
private static final org.apache.commons.logging.Log LOG
-
PFB_HEADER_LENGTH
private static final int PFB_HEADER_LENGTH
the pfb header length. (start-marker (1 byte), ascii-/binary-marker (1 byte), size (4 byte)) 3*6 == 18- See Also:
- Constant Field Values
-
START_MARKER
private static final int START_MARKER
the start marker.- See Also:
- Constant Field Values
-
ASCII_MARKER
private static final int ASCII_MARKER
the ascii marker.- See Also:
- Constant Field Values
-
BINARY_MARKER
private static final int BINARY_MARKER
the binary marker.- See Also:
- Constant Field Values
-
EOF_MARKER
private static final int EOF_MARKER
the EOF marker.- See Also:
- Constant Field Values
-
BUFFER_SIZE
private static final int BUFFER_SIZE
buffersize.- See Also:
- Constant Field Values
-
pfbdata
private byte[] pfbdata
the parsed pfb-data.
-
lengths
private final int[] lengths
the lengths of the records (ASCII, BINARY, ASCII)
-
-
Constructor Detail
-
PfbParser
public PfbParser(java.lang.String filename) throws java.io.IOExceptionCreate a new object.- Parameters:
filename- the file name- Throws:
java.io.IOException- if an IO-error occurs.
-
PfbParser
public PfbParser(java.io.InputStream in) throws java.io.IOExceptionCreate a new object.- Parameters:
in- The input.- Throws:
java.io.IOException- if an IO-error occurs.
-
PfbParser
public PfbParser(byte[] bytes) throws java.io.IOExceptionCreate a new object.- Parameters:
bytes- The input.- Throws:
java.io.IOException- if an IO-error occurs.
-
-
Method Detail
-
parsePfb
private void parsePfb(byte[] pfb) throws java.io.IOExceptionParse the pfb-array.- Parameters:
pfb- The pfb-Array- Throws:
java.io.IOException- in an IO-error occurs.
-
readFully
private byte[] readFully(java.io.InputStream in) throws java.io.IOExceptionRead the pfb input.- Parameters:
in- The input.- Returns:
- Returns the pfb-array.
- Throws:
java.io.IOException- if an IO-error occurs.
-
getLengths
public int[] getLengths()
Returns the lengths.- Returns:
- Returns the lengths.
-
getPfbdata
public byte[] getPfbdata()
Returns the pfbdata.- Returns:
- Returns the pfbdata.
-
getInputStream
public java.io.InputStream getInputStream()
Returns the pfb data as stream.- Returns:
- Returns the pfb data as stream.
-
size
public int size()
Returns the size of the pfb-data.- Returns:
- Returns the size of the pfb-data.
-
getSegment1
public byte[] getSegment1()
Returns the first segment- Returns:
- first segment bytes
-
getSegment2
public byte[] getSegment2()
Returns the second segment- Returns:
- second segment bytes
-
-