public final class Streams extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
copy(InputStream in,
OutputStream out)
Writes the input stream to the output stream.
|
static int |
copy(InputStream in,
OutputStream out,
int bufSize)
Writes the input stream to the output stream.
|
static int |
copyAndClose(InputStream in,
OutputStream out)
Writes the input stream to the output stream.
|
static void |
loadFromXml(Properties properties,
InputStream inputStream)
Loads properties from an XML input stream into the provided properties object.
|
static InputStream |
readNonCaching(URL url)
Sets the connection to a URL as non-caching and returns the input stream.
|
static String |
readString(InputStream in)
Reads a stream as a string.
|
static String |
readString(InputStream in,
CharSequence encoding)
Reads a string using a character encoding.
|
static String |
readString(Reader in)
Reads all input from a reader into a string.
|
public static int copyAndClose(InputStream in, OutputStream out) throws IOException
in - The input streamout - The output streamIOExceptionpublic static int copy(InputStream in, OutputStream out) throws IOException
in - The input streamout - The output streamIOExceptionpublic static int copy(InputStream in, OutputStream out, int bufSize) throws IOException
in - The input streamout - The output streambufSize - The buffer size. A good value is 4096.IOExceptionpublic static void loadFromXml(Properties properties, InputStream inputStream) throws IOException
properties - The object to load the properties intoinputStream - IOException - When the input stream could not be read frompublic static InputStream readNonCaching(URL url) throws IOException
url - the url to read fromIOException - when a connection cannot be openedpublic static String readString(InputStream in) throws IOException
in - The input streamIOExceptionpublic static String readString(InputStream in, CharSequence encoding) throws IOException
in - The inputencoding - The character encoding of the input dataIOExceptionpublic static String readString(Reader in) throws IOException
in - The inputIOExceptionCopyright © 2006–2021 Apache Software Foundation. All rights reserved.