public abstract class Streams
extends java.lang.Object
Mainly for use within the framework, but also useful for application code.
Modifier and Type | Field and Description |
---|---|
static int |
BUFFER_SIZE |
Constructor and Description |
---|
Streams() |
Modifier and Type | Method and Description |
---|---|
static void |
copy(byte[] in,
java.io.OutputStream out)
Copy the contents of the given byte array to the given OutputStream.
|
static long |
copy(java.io.InputStream in,
java.io.OutputStream out) |
static long |
copy(java.io.InputStream in,
java.io.OutputStream out,
byte[] buffer)
Copy the contents of the given InputStream to the given OutputStream.
|
static int |
copy(java.io.Reader in,
java.io.Writer out)
Copy the contents of the given Reader to the given Writer.
|
static void |
copy(java.lang.String in,
java.io.Writer out)
Copy the contents of the given String to the given output Writer.
|
static java.lang.String |
copyToString(java.io.Reader in)
Copy the contents of the given Reader into a String.
|
static BytesStream |
flushOnCloseStream(BytesStream os)
Wraps the given
BytesStream in a StreamOutput that simply flushes when
close is called. |
static java.util.List<java.lang.String> |
readAllLines(java.io.InputStream input) |
static void |
readAllLines(java.io.InputStream input,
java.util.function.Consumer<java.lang.String> consumer) |
static int |
readFully(java.io.InputStream reader,
byte[] dest) |
static int |
readFully(java.io.InputStream reader,
byte[] dest,
int offset,
int len) |
static int |
readFully(java.io.Reader reader,
char[] dest) |
static int |
readFully(java.io.Reader reader,
char[] dest,
int offset,
int len) |
public static final int BUFFER_SIZE
public static long copy(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public static long copy(java.io.InputStream in, java.io.OutputStream out, byte[] buffer) throws java.io.IOException
in
- the stream to copy fromout
- the stream to copy tojava.io.IOException
- in case of I/O errorspublic static void copy(byte[] in, java.io.OutputStream out) throws java.io.IOException
in
- the byte array to copy fromout
- the OutputStream to copy tojava.io.IOException
- in case of I/O errorspublic static int copy(java.io.Reader in, java.io.Writer out) throws java.io.IOException
in
- the Reader to copy fromout
- the Writer to copy tojava.io.IOException
- in case of I/O errorspublic static void copy(java.lang.String in, java.io.Writer out) throws java.io.IOException
in
- the String to copy fromout
- the Writer to copy tojava.io.IOException
- in case of I/O errorspublic static java.lang.String copyToString(java.io.Reader in) throws java.io.IOException
in
- the reader to copy fromjava.io.IOException
- in case of I/O errorspublic static int readFully(java.io.Reader reader, char[] dest) throws java.io.IOException
java.io.IOException
public static int readFully(java.io.Reader reader, char[] dest, int offset, int len) throws java.io.IOException
java.io.IOException
public static int readFully(java.io.InputStream reader, byte[] dest) throws java.io.IOException
java.io.IOException
public static int readFully(java.io.InputStream reader, byte[] dest, int offset, int len) throws java.io.IOException
java.io.IOException
public static java.util.List<java.lang.String> readAllLines(java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static void readAllLines(java.io.InputStream input, java.util.function.Consumer<java.lang.String> consumer) throws java.io.IOException
java.io.IOException
public static BytesStream flushOnCloseStream(BytesStream os)
BytesStream
in a StreamOutput
that simply flushes when
close is called.