Top Description Fields Constructors Methods
org.apache.fontbox.pfb

public Class PfbParser

extends Object
Class Inheritance
Imports
java.io.ByteArrayInputStream, .ByteArrayOutputStream, .EOFException, .IOException, .InputStream, java.nio.file.Files, .Paths, java.util.ArrayList, .Arrays, .List, org.apache.commons.logging.Log, .LogFactory

Parser for a pfb-file.
Authors
Ben Litchfield, Michael Niedermair

Field Summary

Modifier and TypeField and Description
private static final int
ASCII_MARKER

the ascii marker.

private static final int
BINARY_MARKER

the binary marker.

private static final int
BUFFER_SIZE

buffersize.

private static final int
EOF_MARKER

the EOF marker.

private final int[]
lengths

the lengths of the records (ASCII, BINARY, ASCII)

private static final Log
private static final int
PFB_HEADER_LENGTH

the pfb header length.

private byte[]
pfbdata

the parsed pfb-data.

private static final int
START_MARKER

the start marker.

Constructor Summary

AccessConstructor and Description
public
PfbParser(final String
the file name
filename
)

Create a new object.

public
PfbParser(final InputStream
The input.
in
)

Create a new object.

public
PfbParser(final byte[]
The input.
bytes
)

Create a new object.

Method Summary

Modifier and TypeMethod and Description
public InputStream

Returns:

Returns the pfb data as stream.
getInputStream
()

Returns the pfb data as stream.

public int[]

Returns:

Returns the lengths.
getLengths
()

Returns the lengths.

public byte[]

Returns:

Returns the pfbdata.
getPfbdata
()

Returns the pfbdata.

public byte[]

Returns:

first segment bytes
getSegment1
()

Returns the first segment

public byte[]

Returns:

second segment bytes
getSegment2
()

Returns the second segment

private void
parsePfb(final byte[]
The pfb-Array
pfb
)

Parse the pfb-array.

private byte[]

Returns:

Returns the pfb-array.
readFully
(final InputStream
The input.
in
)

Read the pfb input.

public int

Returns:

Returns the size of the pfb-data.
size
()

Returns the size of the pfb-data.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ASCII_MARKERback to summary
private static final int ASCII_MARKER

the ascii marker.

BINARY_MARKERback to summary
private static final int BINARY_MARKER

the binary marker.

BUFFER_SIZEback to summary
private static final int BUFFER_SIZE

buffersize.

EOF_MARKERback to summary
private static final int EOF_MARKER

the EOF marker.

lengthsback to summary
private final int[] lengths

the lengths of the records (ASCII, BINARY, ASCII)

LOGback to summary
private static final Log LOG
PFB_HEADER_LENGTHback to summary
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

pfbdataback to summary
private byte[] pfbdata

the parsed pfb-data.

START_MARKERback to summary
private static final int START_MARKER

the start marker.

Constructor Detail

PfbParserback to summary
public PfbParser(final String filename) throws IOException

Create a new object.

Parameters
filename:String

the file name

Exceptions
IOException:
if an IO-error occurs.
PfbParserback to summary
public PfbParser(final InputStream in) throws IOException

Create a new object.

Parameters
in:InputStream

The input.

Exceptions
IOException:
if an IO-error occurs.
PfbParserback to summary
public PfbParser(final byte[] bytes) throws IOException

Create a new object.

Parameters
bytes:byte[]

The input.

Exceptions
IOException:
if an IO-error occurs.

Method Detail

getInputStreamback to summary
public InputStream getInputStream()

Returns the pfb data as stream.

Returns:InputStream

Returns the pfb data as stream.

getLengthsback to summary
public int[] getLengths()

Returns the lengths.

Returns:int[]

Returns the lengths.

getPfbdataback to summary
public byte[] getPfbdata()

Returns the pfbdata.

Returns:byte[]

Returns the pfbdata.

getSegment1back to summary
public byte[] getSegment1()

Returns the first segment

Returns:byte[]

first segment bytes

getSegment2back to summary
public byte[] getSegment2()

Returns the second segment

Returns:byte[]

second segment bytes

parsePfbback to summary
private void parsePfb(final byte[] pfb) throws IOException

Parse the pfb-array.

Parameters
pfb:byte[]

The pfb-Array

Exceptions
IOException:
in an IO-error occurs.
readFullyback to summary
private byte[] readFully(final InputStream in) throws IOException

Read the pfb input.

Parameters
in:InputStream

The input.

Returns:byte[]

Returns the pfb-array.

Exceptions
IOException:
if an IO-error occurs.
sizeback to summary
public int size()

Returns the size of the pfb-data.

Returns:int

Returns the size of the pfb-data.