|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.netarkivet.common.utils.StreamUtils
public class StreamUtils
Utilities for handling streams.
Constructor Summary | |
---|---|
StreamUtils()
|
Method Summary | |
---|---|
static void |
copyInputStreamToJspWriter(java.io.InputStream in,
javax.servlet.jsp.JspWriter out)
Will copy everything from input stream to jsp writer, closing input stream afterwards. |
static void |
copyInputStreamToOutputStream(java.io.InputStream in,
java.io.OutputStream out)
Will copy everything from input stream to output stream, closing input stream afterwards. |
static java.lang.String |
getInputStreamAsString(java.io.InputStream in)
Reads an input stream and returns it as a string. |
static byte[] |
inputStreamToBytes(java.io.InputStream data,
int dataLength)
Convert inputStream to byte array. |
static void |
writeXmlToStream(org.dom4j.Document doc,
java.io.OutputStream os)
Write document tree to stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StreamUtils()
Method Detail |
---|
public static void copyInputStreamToJspWriter(java.io.InputStream in, javax.servlet.jsp.JspWriter out)
in
- Inputstream to copy fromout
- JspWriter to copy to
ArgumentNotValid
- if either parameter is null
IOFailure
- if a read or write error happens during copypublic static void copyInputStreamToOutputStream(java.io.InputStream in, java.io.OutputStream out)
in
- Inputstream to copy fromout
- Outputstream to copy to
ArgumentNotValid
- if either parameter is null
IOFailure
- if a read or write error happens during copypublic static void writeXmlToStream(org.dom4j.Document doc, java.io.OutputStream os)
doc
- the document tree to save.os
- the stream to write xml to
IOFailure
- On trouble writing XML to stream.public static java.lang.String getInputStreamAsString(java.io.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(java.io.InputStream data, int dataLength)
data
- inputstreamdataLength
- length of inputstream (must be larger than 0)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |