public final class Streams
extends java.lang.Object
Exceptions that are thrown and not explicitly declared are ignored.
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE
The default buffer size that will be used for buffered operations.
|
private static org.jboss.logging.Logger |
log |
| Constructor and Description |
|---|
Streams() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
close(java.io.InputStream stream)
Attempt to close an InputStream.
|
static boolean |
close(java.io.InputStream[] streams)
Attempt to close an array of InputStreams.
|
static boolean |
close(java.lang.Object stream)
Attempt to close an InputStream or OutputStream.
|
static boolean |
close(java.lang.Object[] streams)
Attempt to close an array of InputStreama and/or
OutputStreams.
|
static boolean |
close(java.io.OutputStream stream)
Attempt to close an OutputStream.
|
static boolean |
close(java.io.OutputStream[] streams)
Attempt to close an array of OutputStreams.
|
static long |
copy(java.io.InputStream input,
java.io.OutputStream output)
Copy all of the bytes from the input stream to the output stream.
|
static long |
copy(java.io.InputStream input,
java.io.OutputStream output,
byte[] buffer)
Copy all of the bytes from the input stream to the output stream.
|
static long |
copy(java.io.InputStream input,
java.io.OutputStream output,
int size)
Copy all of the bytes from the input stream to the output stream.
|
static long |
copyb(java.io.InputStream input,
java.io.OutputStream output)
Copy all of the bytes from the input stream to the output stream
wrapping streams in buffers as needed.
|
static long |
copySome(java.io.InputStream input,
java.io.OutputStream output,
byte[] buffer,
long length)
Copy a limited number of bytes from the input stream to the
output stream.
|
static long |
copySome(java.io.InputStream input,
java.io.OutputStream output,
int size,
long length)
Copy a limited number of bytes from the input stream to the
output stream.
|
static long |
copySome(java.io.InputStream input,
java.io.OutputStream output,
long length)
Copy a limited number of bytes from the input stream to the
output stream.
|
static boolean |
fclose(java.io.OutputStream stream)
Attempt to flush and close an OutputStream.
|
static boolean |
fclose(java.io.OutputStream[] streams)
Attempt to flush and close an array of OutputStreams.
|
static boolean |
flush(java.io.OutputStream stream)
Attempt to flush an OutputStream.
|
static boolean |
flush(java.io.OutputStream[] streams)
Attempt to flush an array of OutputStreams.
|
private static final org.jboss.logging.Logger log
public static final int DEFAULT_BUFFER_SIZE
public static boolean close(java.io.InputStream stream)
stream - InputStream to attempt to close.public static boolean close(java.io.OutputStream stream)
stream - OutputStream to attempt to close.public static boolean close(java.lang.Object stream)
stream - Stream to attempt to close.java.lang.IllegalArgumentException - Stream is not an InputStream
or OuputStream.public static boolean close(java.io.InputStream[] streams)
streams - Array of InputStreams to attempt to close.public static boolean close(java.io.OutputStream[] streams)
streams - Array of OutputStreams to attempt to close.public static boolean close(java.lang.Object[] streams)
streams - Array of streams to attempt to close.java.lang.IllegalArgumentException - Stream is not an InputStream
or OuputStream. Closing
stops at the last valid stream
object in this case.public static boolean fclose(java.io.OutputStream stream)
stream - OutputStream to attempt to flush and close.public static boolean fclose(java.io.OutputStream[] streams)
streams - OutputStreams to attempt to flush and close.public static boolean flush(java.io.OutputStream stream)
stream - OutputStream to attempt to flush.public static boolean flush(java.io.OutputStream[] streams)
streams - OutputStreams to attempt to flush.public static long copy(java.io.InputStream input,
java.io.OutputStream output,
byte[] buffer)
throws java.io.IOException
input - Stream to read bytes from.output - Stream to write bytes to.buffer - The buffer to use while copying.java.io.IOException - Failed to copy bytes.public static long copy(java.io.InputStream input,
java.io.OutputStream output,
int size)
throws java.io.IOException
input - Stream to read bytes from.output - Stream to write bytes to.size - The size of the buffer to use while copying.java.io.IOException - Failed to copy bytes.public static long copy(java.io.InputStream input,
java.io.OutputStream output)
throws java.io.IOException
input - Stream to read bytes from.output - Stream to write bytes to.java.io.IOException - Failed to copy bytes.public static long copyb(java.io.InputStream input,
java.io.OutputStream output)
throws java.io.IOException
input - Stream to read bytes from.output - Stream to write bytes to.java.io.IOException - Failed to copy bytes.public static long copySome(java.io.InputStream input,
java.io.OutputStream output,
byte[] buffer,
long length)
throws java.io.IOException
input - Stream to read bytes from.output - Stream to write bytes to.buffer - The buffer to use while copying.length - The maximum number of bytes to copy.java.io.IOException - Failed to copy bytes.public static long copySome(java.io.InputStream input,
java.io.OutputStream output,
int size,
long length)
throws java.io.IOException
input - Stream to read bytes from.output - Stream to write bytes to.size - The size of the buffer to use while copying.length - The maximum number of bytes to copy.java.io.IOException - Failed to copy bytes.public static long copySome(java.io.InputStream input,
java.io.OutputStream output,
long length)
throws java.io.IOException
input - Stream to read bytes from.output - Stream to write bytes to.length - The maximum number of bytes to copy.java.io.IOException - Failed to copy bytes.