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 chunked 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) throws StreamException
path - Path to file.StreamException - on stream IO errors.public static byte[] readAll(File file) throws StreamException
file - File to read.StreamException - on stream IO errors.public static byte[] readAll(InputStream input) throws StreamException
input - Input stream to read.StreamException - on stream IO errors.public static byte[] readAll(InputStream input, int sizeHint) throws StreamException
input - Input stream to read.sizeHint - Estimate of amount of data to be read in bytes.StreamException - on stream IO errors.public static String readAll(Reader reader) throws StreamException
reader - Reader over character data.StreamException - on stream IO errors.public static String readAll(Reader reader, int sizeHint) throws StreamException
reader - Reader over character data.sizeHint - Estimate of amount of data to be read in number of characters.StreamException - on stream IO errors.public static void pipeAll(InputStream in, OutputStream out, ChunkHandler handler) throws StreamException
in - Input stream providing data to process.out - Output stream holding processed data.handler - Arbitrary handler for processing input stream.StreamException - on stream IO errors.public static InputStream makeStream(File file) throws StreamException
file - Input stream source.StreamException - on stream IO errors.public static Reader makeReader(File file) throws StreamException
file - Reader source.StreamException - on stream IO errors.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 © 2003-2024 Virginia Tech. All Rights Reserved.