public final class StreamUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
append(byte[] array1,
byte[] array2)
Creates a new array from the content of the two given byte arrays.
|
static void |
closeQuietly(Closeable closeable) |
static boolean |
compare(InputStream content1,
InputStream content2)
Compares the given input streams (pair-wise byte comparison).
|
static void |
copyInToOut(InputStream in,
OutputStream out,
ByteBuffer buffer,
boolean forceClose)
Copies the content from in to out.
|
static void |
copyInToOut(InputStream in,
OutputStream out,
int bufferSize,
boolean forceClose)
Deprecated.
Use
Streams.stream(java.io.InputStream, java.io.OutputStream, int) instead. |
static void |
copyInToOut(InputStream in,
String inputEncoding,
OutputStream out,
String outputEncoding,
int bufferSize,
boolean forceClose)
Copies the content from in to out.
|
static byte[] |
readBytes(InputStream in,
int bufferSize,
boolean forceClose)
Deprecated.
use
Streams.convertInputStreamToByteArray(java.io.InputStream) instead |
static void |
transferFrom(ReadableByteChannel in,
FileChannel out,
int buffer,
boolean forceClose)
Transfers (copies) the content from in to out.
|
static void |
transferTo(FileChannel in,
WritableByteChannel out,
int buffer,
boolean forceClose)
Transforms (copies) the content of the given FileChannel to the given
WritableByteChannel.
|
static long |
transferTo(ReadableByteChannel in,
WritableByteChannel out,
int size,
boolean forceClose) |
public static void copyInToOut(InputStream in, String inputEncoding, OutputStream out, String outputEncoding, int bufferSize, boolean forceClose) throws IOException
in - The source InputStream.inputEncoding - The encoding of the input stream.out - The destination OutputStream.outputEncoding - The encoding of the output stream.bufferSize - The buffer size.forceClose - If true, the given streams will be closed after execution.IOException - Throws an IOException if an IO error occurs.public static void copyInToOut(InputStream in, OutputStream out, ByteBuffer buffer, boolean forceClose) throws IOException
in - The source InputStream.out - The destination OutputStream.buffer - The buffer size.forceClose - If true, the given channels will be closed after execution.IOException - Throws an IOException if an IO error occurs.public static void transferFrom(ReadableByteChannel in, FileChannel out, int buffer, boolean forceClose) throws IOException
in - The source ReadableByteChannel.out - The destination FileChannel.buffer - The buffer size.forceClose - If true, the given channels will be closed after execution.IOException - Throws an IOException if an IO error occurs.public static void transferTo(FileChannel in, WritableByteChannel out, int buffer, boolean forceClose) throws IOException
in - The FileChannel to read byte from.out - The WritableByteChannel to transform bytes to.buffer - The buffer size.forceClose - If true, the given channels will be closed after execution.IOException - Throws an IOException if an IO error occurs.public static long transferTo(ReadableByteChannel in, WritableByteChannel out, int size, boolean forceClose) throws IOException
IOException@Deprecated public static void copyInToOut(InputStream in, OutputStream out, int bufferSize, boolean forceClose) throws IOException
Streams.stream(java.io.InputStream, java.io.OutputStream, int) instead.in - The InputStream to read the content from.out - The OutputStream to copy the content to.bufferSize - The buffer size.forceClose - If true, the given streams will be closed after execution.IOException - Throws an IOException if an IO error occurs.public static byte[] append(byte[] array1,
byte[] array2)
array1 - The first content array.array2 - The second content array.@Deprecated public static byte[] readBytes(InputStream in, int bufferSize, boolean forceClose) throws IOException
Streams.convertInputStreamToByteArray(java.io.InputStream) insteadin - The InputSteam in to copy.bufferSize - The size of the array to be created.forceClose - It true, all streams will be closed.IOException - Throws an IOException if an IO error occurs.public static void closeQuietly(Closeable closeable)
public static boolean compare(InputStream content1, InputStream content2) throws IOException
content1 - The first InputStream in question.content2 - The second InputStream in question.IOException - Throws an IOException if an IO error occurs.Copyright © 2016 Lexmark Enterprise Software Deutschland GmbH. All rights reserved.