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 void |
delete(File f)
Recursively delete file or directory.
|
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 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.
|
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 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 exceptionpublic static String getExtension(String fileName)
fileName
- the file namepublic static void delete(File f) throws IOException
f
- the file/dir to deleteIOException
- Signals that an I/O exception has occurred.Copyright © 2014. All rights reserved.