public abstract class Streams extends 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,
File out)
Copy the contents of the given byte array to the given output File.
|
static void |
copy(byte[] in,
OutputStream out)
Copy the contents of the given byte array to the given OutputStream.
|
static long |
copy(File in,
File out)
Copy the contents of the given input File to the given output File.
|
static long |
copy(InputStream in,
OutputStream out) |
static long |
copy(InputStream in,
OutputStream out,
byte[] buffer)
Copy the contents of the given InputStream to the given OutputStream.
|
static int |
copy(Reader in,
Writer out)
Copy the contents of the given Reader to the given Writer.
|
static void |
copy(String in,
Writer out)
Copy the contents of the given String to the given output Writer.
|
static byte[] |
copyToByteArray(File in)
Copy the contents of the given input File into a new byte array.
|
static byte[] |
copyToByteArray(InputStream in)
Copy the contents of the given InputStream into a new byte array.
|
static byte[] |
copyToBytesFromClasspath(String path) |
static String |
copyToString(Reader in)
Copy the contents of the given Reader into a String.
|
static String |
copyToStringFromClasspath(ClassLoader classLoader,
String path) |
static String |
copyToStringFromClasspath(String path) |
static List<String> |
readAllLines(InputStream input) |
static void |
readAllLines(InputStream input,
Callback<String> callback) |
static int |
readFully(InputStream reader,
byte[] dest) |
static int |
readFully(InputStream reader,
byte[] dest,
int offset,
int len) |
static int |
readFully(Reader reader,
char[] dest) |
static int |
readFully(Reader reader,
char[] dest,
int offset,
int len) |
public static final int BUFFER_SIZE
public static long copy(File in, File out) throws IOException
in
- the file to copy fromout
- the file to copy toIOException
- in case of I/O errorspublic static void copy(byte[] in, File out) throws IOException
in
- the byte array to copy fromout
- the file to copy toIOException
- in case of I/O errorspublic static byte[] copyToByteArray(File in) throws IOException
in
- the file to copy fromIOException
- in case of I/O errorspublic static long copy(InputStream in, OutputStream out) throws IOException
IOException
public static long copy(InputStream in, OutputStream out, byte[] buffer) throws IOException
in
- the stream to copy fromout
- the stream to copy toIOException
- in case of I/O errorspublic static void copy(byte[] in, OutputStream out) throws IOException
in
- the byte array to copy fromout
- the OutputStream to copy toIOException
- in case of I/O errorspublic static byte[] copyToByteArray(InputStream in) throws IOException
in
- the stream to copy fromIOException
- in case of I/O errorspublic static int copy(Reader in, Writer out) throws IOException
in
- the Reader to copy fromout
- the Writer to copy toIOException
- in case of I/O errorspublic static void copy(String in, Writer out) throws IOException
in
- the String to copy fromout
- the Writer to copy toIOException
- in case of I/O errorspublic static String copyToString(Reader in) throws IOException
in
- the reader to copy fromIOException
- in case of I/O errorspublic static String copyToStringFromClasspath(ClassLoader classLoader, String path) throws IOException
IOException
public static String copyToStringFromClasspath(String path) throws IOException
IOException
public static byte[] copyToBytesFromClasspath(String path) throws IOException
IOException
public static int readFully(Reader reader, char[] dest) throws IOException
IOException
public static int readFully(Reader reader, char[] dest, int offset, int len) throws IOException
IOException
public static int readFully(InputStream reader, byte[] dest) throws IOException
IOException
public static int readFully(InputStream reader, byte[] dest, int offset, int len) throws IOException
IOException
public static List<String> readAllLines(InputStream input) throws IOException
IOException
public static void readAllLines(InputStream input, Callback<String> callback) throws IOException
IOException
Copyright © 2009–2015. All rights reserved.