public abstract class StreamUtil
extends java.lang.Object
Constructor and Description |
---|
StreamUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
copyAndClose(java.io.InputStream input,
java.io.OutputStream out) |
static void |
copyAndClose(java.io.InputStream input,
java.io.Writer out) |
static void |
copyAndClose(java.io.InputStream input,
java.io.Writer out,
java.nio.charset.Charset charset) |
static void |
copyStream(java.io.InputStream input,
java.io.OutputStream output)
Copy from an InputStream to an OutputStream for expected bytes.
|
static void |
copyStream(java.io.InputStream input,
java.io.OutputStream output,
int expected)
Copy from an InputStream to an OutputStream for expected bytes.
|
static java.io.File |
createFile(java.io.InputStream input,
int expected)
Read from the inputstream associated with the socket and write the data
straight out to a unique file in the temporary (system defined) directory
|
static java.io.File |
createFile(java.io.InputStream input,
int expected,
java.lang.String dir)
Read from the inputstream associated with the socket and write the data
straight out to a unique file in the specified directory
|
static java.io.InputStream |
makeCopy(java.io.InputStream input)
Make a copy of an InputStream.
|
public static java.io.File createFile(java.io.InputStream input, int expected) throws java.io.IOException
input
- The inputstream to read fromexpected
- the expected number of bytesjava.io.IOException
- if there was an error creating the filepublic static java.io.File createFile(java.io.InputStream input, int expected, java.lang.String dir) throws java.io.IOException
input
- The inputstream to read fromexpected
- the expected number of bytesdir
- The directory in which to create the filejava.io.IOException
- if there was an creating the filepublic static void copyStream(java.io.InputStream input, java.io.OutputStream output, int expected) throws java.io.IOException
input
- the input stream to read fromoutput
- the output stream to write fromexpected
- the number of bytes to copyjava.io.IOException
- if there was an error.public static void copyStream(java.io.InputStream input, java.io.OutputStream output) throws java.io.IOException
input
- the input stream to read fromoutput
- the output stream to write fromjava.io.IOException
- if there was an IO errorpublic static java.io.InputStream makeCopy(java.io.InputStream input) throws java.io.IOException
This method ensures that the resulting input stream can support a mark(), and reset() call, by copying the contents of the input stream into a ByteArrayInputStream
input
- the InputStream to copyjava.io.IOException
- if there was an error reading the stream.public static void copyAndClose(java.io.InputStream input, java.io.Writer out) throws java.io.IOException
java.io.IOException
public static void copyAndClose(java.io.InputStream input, java.io.Writer out, java.nio.charset.Charset charset) throws java.io.IOException
java.io.IOException
public static void copyAndClose(java.io.InputStream input, java.io.OutputStream out) throws java.io.IOException
java.io.IOException