public class Utils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Utils.SimpleOutputStream
The Class SimpleOutputStream.
|
Modifier and Type | Field and Description |
---|---|
static int |
BUFFER_SIZE
The default buffer size.
|
static CopyOption[] |
COPY_OPTION
The COPY_OPTION used to copy/move files.
|
static SimpleDateFormat |
dateFormater
The date formater.
|
static org.jdom2.Namespace |
dcNS
The DC namespace.
|
static String |
NEWLINE
The newline character.
|
static org.jdom2.Namespace |
omexNs
The OMEX namespace.
|
static org.jdom2.Namespace |
rdfNS
The RDF namespace.
|
static org.jdom2.Namespace |
vcNS
The vcard namespace.
|
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static List<org.jdom2.Element> |
getElementsByTagName(org.jdom2.Element parent,
String name,
org.jdom2.Namespace ns)
Gets elements of an XML subtree by tag name.
|
static String |
getExtension(String fileName)
Extracts the extension of a filename.
|
static void |
packZip(File directory,
File destination,
List<File> fileList)
Create a zip file.
|
static String |
prettyPrintDocument(org.jdom2.Document doc)
Pretty print an XML document.
|
static org.jdom2.Document |
readXmlDocument(Path fileToRead)
Reads an XML file and creates a Document.
|
static boolean |
unpackZip(File zipFilePath,
File destDirectory,
boolean deleteOnExit)
Unpack a zip file.
|
public static final org.jdom2.Namespace rdfNS
public static final org.jdom2.Namespace dcNS
public static final org.jdom2.Namespace vcNS
public static final org.jdom2.Namespace omexNs
public static final SimpleDateFormat dateFormater
public static final int BUFFER_SIZE
public static final String NEWLINE
public static final CopyOption[] COPY_OPTION
public static final org.jdom2.Document readXmlDocument(Path fileToRead) throws org.jdom2.JDOMException, IOException
fileToRead
- the file to readorg.jdom2.JDOMException
- the JDOM exceptionIOException
- Signals that an I/O exception has occurred.public static void packZip(File directory, File destination, List<File> fileList) throws FileNotFoundException, IOException
directory
- the directory to zipdestination
- the destination of the zip filefileList
- the file listFileNotFoundException
- the file not found exceptionIOException
- Signals that an I/O exception has occurred.public static boolean unpackZip(File zipFilePath, File destDirectory, boolean deleteOnExit) throws IOException
zipFilePath
- the zip file pathdestDirectory
- the destination directory to write the packed files todeleteOnExit
- the delete on exitIOException
- Signals that an I/O exception has occurred.public static List<org.jdom2.Element> getElementsByTagName(org.jdom2.Element parent, String name, org.jdom2.Namespace ns)
parent
- the root of the subtreename
- the tag namens
- the namespacepublic static String prettyPrintDocument(org.jdom2.Document doc) throws IOException, TransformerException
doc
- the XML documentIOException
- Signals that an I/O exception has occurred.TransformerException
- the transformer exceptionCopyright © 2014. All rights reserved.