be.fedict.eid.applet.service.signer.odf
Class ODFUtil

java.lang.Object
  extended by be.fedict.eid.applet.service.signer.odf.ODFUtil

public class ODFUtil
extends Object

Helper class to remove some code duplication

Author:
Bart Hanssens

Field Summary
static String MANIFEST_FILE
           
static String MIMETYPE_FILE
           
static String MIMETYPE_START
           
static String SIGNATURE_ELEMENT
           
static String SIGNATURE_FILE
           
static String SIGNATURE_NS
           
 
Constructor Summary
ODFUtil()
           
 
Method Summary
static boolean checkNodes(NodeList nodes, List zipEntries)
           
static InputStream findDataInputStream(InputStream inputStream, String uri)
          Read the zipped data in the ODF package and return the inputstream for a given file / zip entry
static Document getNewDocument()
          Return a new DOM Document
static DocumentBuilder getNewDocumentBuilder()
          Return a new DOM Document Builder
static List getZipEntriesAsList(InputStream odfInputStream)
          Get a list of all the files / zip entries in an ODF package
static boolean isContentFile(ZipEntry zipEntry)
          Checks if a file / zip entry is a content file
static boolean isSelfContained(URL odfUrl)
          Check if an ODF package is self-contained, i.e.
static boolean isSignatureFile(ZipEntry zipEntry)
          Checks if a file / zip entry is a signature file
static boolean isToBeSigned(ZipEntry zipEntry)
          Check if a file / zip entry is to be signed
static Document loadDocument(InputStream documentInputStream)
          Load an XML file from ODF package as a DOM Document
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MANIFEST_FILE

public static String MANIFEST_FILE

MIMETYPE_FILE

public static String MIMETYPE_FILE

MIMETYPE_START

public static String MIMETYPE_START

SIGNATURE_FILE

public static String SIGNATURE_FILE

SIGNATURE_NS

public static String SIGNATURE_NS

SIGNATURE_ELEMENT

public static String SIGNATURE_ELEMENT
Constructor Detail

ODFUtil

public ODFUtil()
Method Detail

loadDocument

public static Document loadDocument(InputStream documentInputStream)
                             throws ParserConfigurationException,
                                    SAXException,
                                    IOException
Load an XML file from ODF package as a DOM Document

Parameters:
documentInputStream -
Returns:
Throws:
ParserConfigurationException
SAXException
IOException

getNewDocument

public static Document getNewDocument()
                               throws ParserConfigurationException
Return a new DOM Document

Returns:
DOM Document
Throws:
ParserConfigurationException

getNewDocumentBuilder

public static DocumentBuilder getNewDocumentBuilder()
                                             throws ParserConfigurationException
Return a new DOM Document Builder

Returns:
DOM Document Builder
Throws:
ParserConfigurationException

findDataInputStream

public static InputStream findDataInputStream(InputStream inputStream,
                                              String uri)
                                       throws IOException
Read the zipped data in the ODF package and return the inputstream for a given file / zip entry

Parameters:
inputStream -
uri -
Returns:
inputstream for the file / zip entry
Throws:
IOException

isContentFile

public static boolean isContentFile(ZipEntry zipEntry)
Checks if a file / zip entry is a content file

Parameters:
zipEntry -
Returns:
true if zip entry is a content file

isSignatureFile

public static boolean isSignatureFile(ZipEntry zipEntry)
Checks if a file / zip entry is a signature file

Parameters:
zipEntry -
Returns:
true if zip entry is a signature file

isToBeSigned

public static boolean isToBeSigned(ZipEntry zipEntry)
Check if a file / zip entry is to be signed

Parameters:
zipEntry -
Returns:
true if zip entry is to be signed

getZipEntriesAsList

public static List getZipEntriesAsList(InputStream odfInputStream)
                                throws IOException
Get a list of all the files / zip entries in an ODF package

Parameters:
odfInputStream -
Returns:
Throws:
IOException

isSelfContained

public static boolean isSelfContained(URL odfUrl)
                               throws IOException,
                                      ParserConfigurationException,
                                      SAXException,
                                      XPathExpressionException
Check if an ODF package is self-contained, i.e. content files don't have OLE objects linked to external files

Parameters:
odfUrl -
Returns:
Throws:
IOException
ParserConfigurationException
SAXException
XPathExpressionException

checkNodes

public static boolean checkNodes(NodeList nodes,
                                 List zipEntries)


Copyright © 2008-2012 FedICT. All Rights Reserved.