public final class StreamUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
CHUNK_SIZE
Buffer size of chunked operations, e.g.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
closeReader(Reader reader)
Closes the given reader and swallows exceptions that may arise during the
process.
|
static void |
closeStream(InputStream in)
Closes the given stream and swallows exceptions that may arise during the
process.
|
static void |
closeStream(OutputStream out)
Closes the given stream and swallows exceptions that may arise during the
process.
|
static void |
closeWriter(Writer writer)
Closes the given writer and swallows exceptions that may arise during the
process.
|
static Reader |
makeReader(File file)
Creates a reader around the given file that presumably contains character
data.
|
static InputStream |
makeStream(File file)
Creates an input stream around the given file.
|
static void |
pipeAll(InputStream in,
OutputStream out,
ChunkHandler handler)
Pipes an input stream into an output stream with chuncked processing.
|
static byte[] |
readAll(File file)
Reads all the data from the given file.
|
static byte[] |
readAll(InputStream input)
Reads all the data from the given input stream.
|
static byte[] |
readAll(InputStream input,
int sizeHint)
Reads all the data from the given input stream.
|
static String |
readAll(Reader reader)
Reads all data from the given reader.
|
static String |
readAll(Reader reader,
int sizeHint)
Reads all data from the given reader.
|
static byte[] |
readAll(String path)
Reads all the data from the file at the given path.
|
public static final int CHUNK_SIZE
pipeAll(java.io.InputStream, java.io.OutputStream,
org.cryptacular.io.ChunkHandler).public static byte[] readAll(String path)
path - Path to file.public static byte[] readAll(File file)
file - File to read.public static byte[] readAll(InputStream input)
input - Input stream to read.public static byte[] readAll(InputStream input, int sizeHint)
input - Input stream to read.sizeHint - Estimate of amount of data to be read in bytes.public static String readAll(Reader reader)
reader - Reader over character data.public static String readAll(Reader reader, int sizeHint)
reader - Reader over character data.sizeHint - Estimate of amount of data to be read in number of
characters.public static void pipeAll(InputStream in, OutputStream out, ChunkHandler handler)
in - Input stream providing data to process.out - Output stream holding processed data.handler - Arbitrary handler for processing input stream.public static InputStream makeStream(File file)
file - Input stream source.public static Reader makeReader(File file)
file - Reader source.public static void closeStream(InputStream in)
in - Input stream to close.public static void closeStream(OutputStream out)
out - Output stream to close.public static void closeReader(Reader reader)
reader - Reader to close.public static void closeWriter(Writer writer)
writer - Writer to close.Copyright © 2016 JBoss by Red Hat. All rights reserved.