Class PfbParser

java.lang.Object
org.apache.fontbox.pfb.PfbParser

public class PfbParser extends Object
Parser for a pfb-file.
  • Field Details

    • 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:
    • START_MARKER

      private static final int START_MARKER
      the start marker.
      See Also:
    • ASCII_MARKER

      private static final int ASCII_MARKER
      the ascii marker.
      See Also:
    • BINARY_MARKER

      private static final int BINARY_MARKER
      the binary marker.
      See Also:
    • PFB_RECORDS

      private static final int[] PFB_RECORDS
      The record types in the pfb-file.
    • BUFFER_SIZE

      private static final int BUFFER_SIZE
      buffersize.
      See Also:
    • pfbdata

      private byte[] pfbdata
      the parsed pfb-data.
    • lengths

      private int[] lengths
      the lengths of the records.
  • Constructor Details

    • PfbParser

      public PfbParser(String filename) throws IOException
      Create a new object.
      Parameters:
      filename - the file name
      Throws:
      IOException - if an IO-error occurs.
    • PfbParser

      public PfbParser(InputStream in) throws IOException
      Create a new object.
      Parameters:
      in - The input.
      Throws:
      IOException - if an IO-error occurs.
    • PfbParser

      public PfbParser(byte[] bytes) throws IOException
      Create a new object.
      Parameters:
      bytes - The input.
      Throws:
      IOException - if an IO-error occurs.
  • Method Details

    • parsePfb

      private void parsePfb(byte[] pfb) throws IOException
      Parse the pfb-array.
      Parameters:
      pfb - The pfb-Array
      Throws:
      IOException - in an IO-error occurs.
    • readFully

      private byte[] readFully(InputStream in) throws IOException
      Read the pfb input.
      Parameters:
      in - The input.
      Returns:
      Returns the pfb-array.
      Throws:
      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 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