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
IOException
public static Resource createResource(String title, String href)
title
- href
- public static Resource createResource(ZipEntry zipEntry, ZipInputStream zipInputStream) throws IOException
zipEntry
- zipInputStream
- IOException
public static Resource createResource(ZipEntry zipEntry, InputStream zipInputStream) throws IOException
IOException
public static byte[] recode(String inputEncoding, String outputEncoding, byte[] input) throws UnsupportedEncodingException
inputEncoding
- outputEncoding
- input
- UnsupportedEncodingException
public static InputSource getInputSource(Resource resource) throws IOException
IOException
public 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
- UnsupportedEncodingException
SAXException
IOException
ParserConfigurationException
Copyright © 2009–2013. All rights reserved.