public class XfdfReader extends java.lang.Object implements SimpleXMLDocHandler
Modifier and Type | Field and Description |
---|---|
protected java.util.HashMap<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 and Description |
---|
XfdfReader(byte[] xfdfIn)
Reads an XFDF form.
|
XfdfReader(java.io.InputStream is)
Reads an XFDF form.
|
XfdfReader(java.lang.String filename)
Reads an XFDF form.
|
Modifier and Type | Method and Description |
---|---|
void |
endDocument()
Called after the document is parsed.
|
void |
endElement(java.lang.String tag)
Called when an end tag is found.
|
java.lang.String |
getField(java.lang.String name)
Gets the field value.
|
java.util.HashMap<java.lang.String,java.lang.String> |
getFields()
Gets all the fields.
|
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.
|
protected java.util.HashMap<java.lang.String,java.util.List<java.lang.String>> listFields
public XfdfReader(java.lang.String filename) throws java.io.IOException
filename
- the file name of the formjava.io.IOException
- on errorpublic XfdfReader(byte[] xfdfIn) throws java.io.IOException
xfdfIn
- the byte array with the formjava.io.IOException
- on errorpublic XfdfReader(java.io.InputStream is) throws java.io.IOException
is
- an InputStream to read the formjava.io.IOException
- on errorpublic java.util.HashMap<java.lang.String,java.lang.String> getFields()
PdfDictionary
with the field content.public java.lang.String getField(java.lang.String name)
name
- the fully qualified field namepublic java.lang.String getFieldValue(java.lang.String name)
null
if the field does not
exist or has no value defined.name
- the fully qualified field namenull
public java.util.List<java.lang.String> getListValues(java.lang.String name)
null
if the field does not
exist or has no value defined.name
- the fully qualified field namenull
public java.lang.String getFileSpec()
public void startElement(java.lang.String tag, java.util.Map<java.lang.String,java.lang.String> h)
startElement
in interface SimpleXMLDocHandler
tag
- the tag nameh
- the tag's attributespublic void endElement(java.lang.String tag)
endElement
in interface SimpleXMLDocHandler
tag
- the tag namepublic void startDocument()
startDocument
in interface SimpleXMLDocHandler
public void endDocument()
endDocument
in interface SimpleXMLDocHandler
public void text(java.lang.String str)
text
in interface SimpleXMLDocHandler
str
- the text element, probably a fragment.Copyright © 2013. All Rights Reserved.