Class Type1Font.PSParser

  • Enclosing class:
    Type1Font

    class Type1Font.PSParser
    extends java.lang.Object
    PostScript reader (not a parser, as the name would seem to indicate).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) byte[] data  
      (package private) int loc  
    • Constructor Summary

      Constructors 
      Constructor Description
      PSParser​(byte[] data, int start)
      create a PostScript reader given some data and an initial offset into that data.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getLoc()
      get the current location within the input stream
      byte[] getNEncodedBytes​(int n, int key, int skip)
      treat the next n bytes of the input stream as encoded information to be decrypted.
      float[] readArray​(int count)
      read a set of numbers from the input.
      java.lang.String readThing()
      get the next postscript "word".
      void setLoc​(int loc)
      set the current location within the input stream
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • data

        byte[] data
      • loc

        int loc
    • Constructor Detail

      • PSParser

        public PSParser​(byte[] data,
                        int start)
        create a PostScript reader given some data and an initial offset into that data.
        Parameters:
        data - the bytes of the postscript information
        start - an initial offset into the data
    • Method Detail

      • readThing

        public java.lang.String readThing()
        get the next postscript "word". This is basically the next non-whitespace block between two whitespace delimiters. This means that something like " [2 4 53]" will produce three items, while " [2 4 56 ]" will produce four.
      • readArray

        public float[] readArray​(int count)
        read a set of numbers from the input. This method doesn't pay any attention to "[" or "]" delimiters, and reads any non-numeric items as the number 0.
        Parameters:
        count - the number of items to read
        Returns:
        an array of count floats
      • getLoc

        public int getLoc()
        get the current location within the input stream
      • setLoc

        public void setLoc​(int loc)
        set the current location within the input stream
      • getNEncodedBytes

        public byte[] getNEncodedBytes​(int n,
                                       int key,
                                       int skip)
        treat the next n bytes of the input stream as encoded information to be decrypted.
        Parameters:
        n - the number of bytes to decrypt
        key - the decryption key
        skip - the number of bytes to skip at the beginning of the decryption
        Returns:
        an array of decrypted bytes. The length of the array will be n-skip.