public final class DataUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static Document |
load(java.io.File in,
java.lang.String charsetName,
java.lang.String baseUri)
Loads a file to a Document.
|
static Document |
load(java.io.InputStream in,
java.lang.String charsetName,
java.lang.String baseUri)
Parses a Document from an input steam.
|
static Document |
load(java.io.InputStream in,
java.lang.String charsetName,
java.lang.String baseUri,
Parser parser)
Parses a Document from an input steam, using the provided Parser.
|
static java.nio.ByteBuffer |
readToByteBuffer(java.io.InputStream inStream,
int maxSize)
Read the input stream into a byte buffer.
|
public static Document load(java.io.File in, java.lang.String charsetName, java.lang.String baseUri) throws java.io.IOException
in
- file to loadcharsetName
- character set of inputbaseUri
- base URI of document, to resolve relative links againstjava.io.IOException
- on IO errorpublic static Document load(java.io.InputStream in, java.lang.String charsetName, java.lang.String baseUri) throws java.io.IOException
in
- input stream to parse. You will need to close it.charsetName
- character set of inputbaseUri
- base URI of document, to resolve relative links againstjava.io.IOException
- on IO errorpublic static Document load(java.io.InputStream in, java.lang.String charsetName, java.lang.String baseUri, Parser parser) throws java.io.IOException
in
- input stream to parse. You will need to close it.charsetName
- character set of inputbaseUri
- base URI of document, to resolve relative links againstparser
- alternate parser
to use.java.io.IOException
- on IO errorpublic static java.nio.ByteBuffer readToByteBuffer(java.io.InputStream inStream, int maxSize) throws java.io.IOException
inStream
- the input stream to read frommaxSize
- the maximum size in bytes to read from the stream. Set to 0 to be unlimited.java.io.IOException
- if an exception occurs whilst reading from the input stream.