public final class StreamExtensions extends Object implements Serializable
| Modifier and Type | Method and Description |
|---|---|
static void |
close(InputStream in)
Closes the given InputStream.
|
static void |
close(OutputStream out)
Closes the given OutputStream.
|
static void |
close(Reader reader)
Closes the given Reader.
|
static void |
close(Writer writer)
Closes the given Writer.
|
static boolean |
closeInputStream(InputStream in)
Closes the given InputStream.
|
static boolean |
closeOutputStream(OutputStream out)
Closes the given OutputStream.
|
static boolean |
closeReader(Reader reader)
Closes the given Reader.
|
static boolean |
closeWriter(Writer writer)
Closes the given Writer.
|
static byte[] |
getByteArray(InputStream in)
Returns the given InputStream as a byte array.
|
static byte[] |
getByteArray(InputStream in,
ByteArrayOutputStream os)
Gets the byte array.
|
static InputStream |
getInputStream(File file)
Gets the input stream from a File object.
|
static InputStream |
getInputStream(File file,
boolean createFile)
Gets the input stream from a File object.
|
static OutputStream |
getOutputStream(File file)
Gets the output stream from a File object.
|
static OutputStream |
getOutputStream(File file,
boolean createFile)
Gets the output stream from a File object.
|
static Reader |
getReader(File inputFile)
Gets a Reader from the given file object.
|
static Reader |
getReader(File inputFile,
String encoding,
boolean createFile)
Gets a Reader from the given file object.
|
static long |
getSerialVersionUID(Class<? extends Serializable> clazz)
Gets the SerialVersionUID from the given Class.
|
static Writer |
getWriter(File file)
Gets a Writer from the given file object.
|
static Writer |
getWriter(File file,
String encoding,
boolean createFile)
Gets a Writer from the given file object.
|
static void |
writeInputStreamToOutputStream(InputStream inputStream,
OutputStream outputStream,
boolean closeStream)
The Method writeInputStreamToOutputStream(InputStream, OutputStream, boolean) writes to the
given OutputStream from an opened InputStream.
|
public static void close(InputStream in) throws IOException
in - The InputStream to close.IOException - Signals that an I/O exception has occurred.public static void close(OutputStream out) throws IOException
out - The OutputStream to close.IOException - Signals that an I/O exception has occurred.public static void close(Reader reader) throws IOException
reader - The Reader to close.IOException - Signals that an I/O exception has occurred.public static void close(Writer writer) throws IOException
writer - The Writer to close.IOException - Signals that an I/O exception has occurred.public static boolean closeInputStream(InputStream in)
in - The InputStream to close.public static boolean closeOutputStream(OutputStream out)
out - The OutputStream to close.public static boolean closeReader(Reader reader)
reader - The Reader to close.public static boolean closeWriter(Writer writer)
writer - The Writer to close.public static byte[] getByteArray(InputStream in) throws IOException
in - The InputStream.IOException - Signals that an I/O exception has occurred.public static byte[] getByteArray(InputStream in, ByteArrayOutputStream os) throws IOException
in - The InputStream.os - The ByteArrayOutputStream.IOException - Signals that an I/O exception has occurred.public static InputStream getInputStream(File file) throws IOException
file - the file.IOException - Signals that an I/O exception has occurred.public static InputStream getInputStream(File file, boolean createFile) throws IOException
file - the filecreateFile - If true and the file does not exist it will be create a new file.IOException - Signals that an I/O exception has occurred.public static OutputStream getOutputStream(File file) throws IOException
file - the file.IOException - Signals that an I/O exception has occurred.public static OutputStream getOutputStream(File file, boolean createFile) throws IOException
file - the filecreateFile - If true and the file does not exist it will be create a new file.IOException - Signals that an I/O exception has occurred.public static Reader getReader(File inputFile) throws IOException
inputFile - the input file.IOException - Signals that an I/O exception has occurred.public static Reader getReader(File inputFile, String encoding, boolean createFile) throws IOException
inputFile - the input fileencoding - The encoding from the file.createFile - If true and the file does not exist it will be create a new file.IOException - Signals that an I/O exception has occurred.public static long getSerialVersionUID(Class<? extends Serializable> clazz)
clazz - The classpublic static Writer getWriter(File file) throws IOException
file - the file.IOException - Signals that an I/O exception has occurred.public static Writer getWriter(File file, String encoding, boolean createFile) throws IOException
file - the fileencoding - The encoding from the file.createFile - the create fileIOException - Signals that an I/O exception has occurred.public static void writeInputStreamToOutputStream(InputStream inputStream, OutputStream outputStream, boolean closeStream) throws IOException
inputStream - The opened InputStream.outputStream - The opened OutputStream.closeStream - If true then close the outputStream otherwise keep open.IOException - Signals that an I/O exception has occurred.Copyright © 2015–2016 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.