public class ResourceUtil extends Object
| Constructor and Description |
|---|
ResourceUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Resource |
createResource(File file) |
static Resource |
createResource(String title,
String href)
Creates a resource with as contents a html page with the given title.
|
static Resource |
createResource(ZipEntry zipEntry,
InputStream zipInputStream) |
static Resource |
createResource(ZipEntry zipEntry,
ZipInputStream zipInputStream)
Creates a resource out of the given zipEntry and zipInputStream.
|
static Document |
getAsDocument(Resource resource)
Reads parses the xml therein and returns the result as a Document
|
static Document |
getAsDocument(Resource resource,
DocumentBuilder documentBuilder)
Reads the given resources inputstream, parses the xml therein and returns the result as a Document
|
static InputSource |
getInputSource(Resource resource)
Gets the contents of the Resource as an InputSource in a null-safe manner.
|
static byte[] |
recode(String inputEncoding,
String outputEncoding,
byte[] input)
Converts a given string from given input character encoding to the requested output character encoding.
|
public static Resource createResource(File file) throws IOException
IOExceptionpublic static Resource createResource(String title, String href)
title - href - public static Resource createResource(ZipEntry zipEntry, ZipInputStream zipInputStream) throws IOException
zipEntry - zipInputStream - IOExceptionpublic static Resource createResource(ZipEntry zipEntry, InputStream zipInputStream) throws IOException
IOExceptionpublic static byte[] recode(String inputEncoding, String outputEncoding, byte[] input) throws UnsupportedEncodingException
inputEncoding - outputEncoding - input - UnsupportedEncodingExceptionpublic static InputSource getInputSource(Resource resource) throws IOException
IOExceptionpublic static Document getAsDocument(Resource resource) throws UnsupportedEncodingException, SAXException, IOException, ParserConfigurationException
public static Document getAsDocument(Resource resource, DocumentBuilder documentBuilder) throws UnsupportedEncodingException, SAXException, IOException, ParserConfigurationException
resource - documentBuilder - UnsupportedEncodingExceptionSAXExceptionIOExceptionParserConfigurationExceptionCopyright © 2009–2017. All rights reserved.