Class XfdfReader

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Stack<java.lang.String> fieldNames  
      private java.util.Map<java.lang.String,​java.lang.String> fields  
      private java.util.Stack<java.lang.String> fieldValues  
      private java.lang.String fileSpec  
      private boolean foundRoot  
      private java.util.Map<java.lang.String,​java.util.List<java.lang.String>> listFields
      Storage for field values if there's more than one value for a field.
    • Constructor Summary

      Constructors 
      Constructor Description
      XfdfReader​(byte[] xfdfIn)
      Reads an XFDF form.
      XfdfReader​(java.lang.String filename)
      Reads an XFDF form.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void endDocument()
      Called after the document is parsed.
      void endElement​(java.lang.String tag)
      Called when an end tag is found.
      java.util.Map<java.lang.String,​java.lang.String> getAllFields()  
      java.lang.String getField​(java.lang.String name)
      Gets the field value.
      java.lang.String getFieldValue​(java.lang.String name)
      Gets the field value or null if the field does not exist or has no value defined.
      java.lang.String getFileSpec()
      Gets the PDF file specification contained in the FDF.
      java.util.List<java.lang.String> getListValues​(java.lang.String name)
      Gets the field values for a list or null if the field does not exist or has no value defined.
      void startDocument()
      Called when the document starts to be parsed.
      void startElement​(java.lang.String tag, java.util.Map<java.lang.String,​java.lang.String> h)
      Called when a start tag is found.
      void text​(java.lang.String str)
      Called when a text element is found.
      • Methods inherited from class java.lang.Object

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

      • foundRoot

        private boolean foundRoot
      • fieldNames

        private java.util.Stack<java.lang.String> fieldNames
      • fieldValues

        private java.util.Stack<java.lang.String> fieldValues
      • fields

        private java.util.Map<java.lang.String,​java.lang.String> fields
      • listFields

        private java.util.Map<java.lang.String,​java.util.List<java.lang.String>> listFields
        Storage for field values if there's more than one value for a field.
        Since:
        2.1.4
      • fileSpec

        private java.lang.String fileSpec
    • Constructor Detail

      • XfdfReader

        public XfdfReader​(java.lang.String filename)
                   throws java.io.IOException
        Reads an XFDF form.
        Parameters:
        filename - the file name of the form
        Throws:
        java.io.IOException - on error
      • XfdfReader

        public XfdfReader​(byte[] xfdfIn)
                   throws java.io.IOException
        Reads an XFDF form.
        Parameters:
        xfdfIn - the byte array with the form
        Throws:
        java.io.IOException - on error
    • Method Detail

      • getAllFields

        public java.util.Map<java.lang.String,​java.lang.String> getAllFields()
        Specified by:
        getAllFields in interface FieldReader
      • getField

        public java.lang.String getField​(java.lang.String name)
        Gets the field value.
        Parameters:
        name - the fully qualified field name
        Returns:
        the field's value
      • getFieldValue

        public java.lang.String getFieldValue​(java.lang.String name)
        Gets the field value or null if the field does not exist or has no value defined.
        Specified by:
        getFieldValue in interface FieldReader
        Parameters:
        name - the fully qualified field name
        Returns:
        the field value or null
      • getListValues

        public java.util.List<java.lang.String> getListValues​(java.lang.String name)
        Gets the field values for a list or null if the field does not exist or has no value defined.
        Specified by:
        getListValues in interface FieldReader
        Parameters:
        name - the fully qualified field name
        Returns:
        the field values or null
        Since:
        2.1.4
      • getFileSpec

        public java.lang.String getFileSpec()
        Gets the PDF file specification contained in the FDF.
        Returns:
        the PDF file specification contained in the FDF
      • startElement

        public void startElement​(java.lang.String tag,
                                 java.util.Map<java.lang.String,​java.lang.String> h)
        Called when a start tag is found.
        Specified by:
        startElement in interface SimpleXMLDocHandler
        Parameters:
        tag - the tag name
        h - the tag's attributes
      • endElement

        public void endElement​(java.lang.String tag)
        Called when an end tag is found.
        Specified by:
        endElement in interface SimpleXMLDocHandler
        Parameters:
        tag - the tag name
      • text

        public void text​(java.lang.String str)
        Called when a text element is found.
        Specified by:
        text in interface SimpleXMLDocHandler
        Parameters:
        str - the text element, probably a fragment.