Class PostscriptParser.PSElement

java.lang.Object
org.docx4j.fonts.fop.fonts.type1.PostscriptParser.PSElement
Direct Known Subclasses:
PostscriptParser.PSDictionary, PostscriptParser.PSFixedArray, PostscriptParser.PSSubroutine, PostscriptParser.PSVariable, PostscriptParser.PSVariableArray
Enclosing class:
PostscriptParser

public abstract class PostscriptParser.PSElement
extends java.lang.Object
A base Postscript element class
  • Field Summary

    Fields
    Modifier and Type Field Description
    protected java.util.LinkedHashMap<java.lang.String,​int[]> binaryEntries  
    protected int endPoint  
    protected boolean hasMore  
    protected java.lang.String operator  
    protected boolean readBinary  
    protected java.util.List<java.lang.String> tokens  
  • Constructor Summary

    Constructors
    Constructor Description
    PSElement​(java.lang.String operator, int startPoint)  
  • Method Summary

    Modifier and Type Method Description
    java.util.LinkedHashMap<java.lang.String,​int[]> getBinaryEntries()  
    int[] getBinaryEntryByIndex​(int index)
    Gets the binary entry location of a given index from the array
    int getEndPoint()
    The end location of the element within the source binary data
    boolean getFoundUnexpected()
    Returns whether unexpected postscript has been found in the element
    java.lang.String getOperator()
    Gets the Postscript element operator
    int getStartPoint()
    The start location of the element within the source binary data
    boolean hasMore()
    Determines if more data is still to be parsed for the Postscript element.
    protected boolean isInteger​(java.lang.String intValue)  
    void parse​(byte cur, int pos)
    Takes over the task of tokenizing the byte data
    abstract void parseByte​(byte cur, int pos)
    Passes responsibility for processing the byte stream to the PostScript object
    abstract void parseToken​(java.lang.String token, int curPos)
    Delegates the parse routine to a sub class
    protected void setFoundUnexpected​(boolean foundUnexpected)
    Sets a value to be true if an expected entry postscript is found in the element.

    Methods inherited from class java.lang.Object

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

    • operator

      protected java.lang.String operator
    • hasMore

      protected boolean hasMore
    • binaryEntries

      protected java.util.LinkedHashMap<java.lang.String,​int[]> binaryEntries
    • tokens

      protected java.util.List<java.lang.String> tokens
    • readBinary

      protected boolean readBinary
    • endPoint

      protected int endPoint
  • Constructor Details

    • PSElement

      public PSElement​(java.lang.String operator, int startPoint)
  • Method Details

    • getOperator

      public java.lang.String getOperator()
      Gets the Postscript element operator
      Returns:
      The operator returned as a string
    • getStartPoint

      public int getStartPoint()
      The start location of the element within the source binary data
      Returns:
      The start location returned as an integer
    • getEndPoint

      public int getEndPoint()
      The end location of the element within the source binary data
      Returns:
      The end location returned as an integer
    • parse

      public void parse​(byte cur, int pos) throws java.io.UnsupportedEncodingException
      Takes over the task of tokenizing the byte data
      Parameters:
      cur - The current byte being read
      Throws:
      java.io.UnsupportedEncodingException
    • parseByte

      public abstract void parseByte​(byte cur, int pos)
      Passes responsibility for processing the byte stream to the PostScript object
      Parameters:
      cur - The byte currently being read
      pos - The position of the given byte
    • parseToken

      public abstract void parseToken​(java.lang.String token, int curPos)
      Delegates the parse routine to a sub class
      Parameters:
      token - The token which to parse
    • isInteger

      protected boolean isInteger​(java.lang.String intValue)
    • getBinaryEntries

      public java.util.LinkedHashMap<java.lang.String,​int[]> getBinaryEntries()
    • getBinaryEntryByIndex

      public int[] getBinaryEntryByIndex​(int index)
      Gets the binary entry location of a given index from the array
      Parameters:
      index - The index for which to retrieve the binary data location
      Returns:
    • hasMore

      public boolean hasMore()
      Determines if more data is still to be parsed for the Postscript element.
      Returns:
      Returns true if more data exists
    • setFoundUnexpected

      protected void setFoundUnexpected​(boolean foundUnexpected)
      Sets a value to be true if an expected entry postscript is found in the element. An example is where the encoding table may have a series of postscript operators altering the state of the array. In this case the only option will be to fully embed the font to avoid incorrect encoding in the resulting subset.
      Parameters:
      foundUnexpected - true if unexpected postscript is found.
    • getFoundUnexpected

      public boolean getFoundUnexpected()
      Returns whether unexpected postscript has been found in the element
      Returns:
      true if unexpected postscript is found