public class StreamUtils extends Object
Constructor and Description |
---|
StreamUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
copyInputStreamToJspWriter(InputStream in,
javax.servlet.jsp.JspWriter out)
Will copy everything from input stream to jsp writer, closing input stream afterwards.
|
static void |
copyInputStreamToOutputStream(InputStream in,
OutputStream out)
Will copy everything from input stream to output stream, closing input stream afterwards.
|
static String |
getInputStreamAsString(InputStream in)
Reads an input stream and returns it as a string.
|
static byte[] |
inputStreamToBytes(InputStream data,
int dataLength)
Convert inputStream to byte array.
|
static void |
writeXmlToStream(org.dom4j.Document doc,
OutputStream os)
Write document tree to stream.
|
public StreamUtils()
public static void copyInputStreamToJspWriter(InputStream in, javax.servlet.jsp.JspWriter out)
in
- Inputstream to copy fromout
- JspWriter to copy toArgumentNotValid
- if either parameter is nullIOFailure
- if a read or write error happens during copypublic static void copyInputStreamToOutputStream(InputStream in, OutputStream out)
in
- Inputstream to copy fromout
- Outputstream to copy toArgumentNotValid
- if either parameter is nullIOFailure
- if a read or write error happens during copypublic static void writeXmlToStream(org.dom4j.Document doc, OutputStream os)
doc
- the document tree to save.os
- the stream to write xml toIOFailure
- On trouble writing XML to stream.public static String getInputStreamAsString(InputStream in) throws ArgumentNotValid, IOFailure
in
- The input stream.ArgumentNotValid
- If the input stream is null.IOFailure
- If an IOException is caught while reading the inputstream.public static byte[] inputStreamToBytes(InputStream data, int dataLength)
data
- inputstreamdataLength
- length of inputstream (must be larger than 0)Copyright © 2005–2016 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.