public final class StreamExtensions extends Object implements Serializable
| Constructor and Description |
|---|
StreamExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static void |
close(InputStream in)
Deprecated.
since the new feature try-with-resources statement this method gets
deprecated.
Note: This method will be removed in next minor release. |
static void |
close(OutputStream out)
Deprecated.
since the new feature try-with-resources statement this method gets
deprecated.
Note: This method will be removed in next minor release. |
static void |
close(Reader reader)
Deprecated.
since the new feature try-with-resources statement this method gets
deprecated.
Note: This method will be removed in next minor release. |
static void |
close(Writer writer)
Deprecated.
since the new feature try-with-resources statement this method gets
deprecated.
Note: This method will be removed in next minor release. |
static boolean |
closeInputStream(InputStream in)
Deprecated.
since the new feature try-with-resources statement this method gets
deprecated.
Note: This method will be removed in next minor release. |
static boolean |
closeOutputStream(OutputStream out)
Deprecated.
since the new feature try-with-resources statement this method gets
deprecated.
Note: This method will be removed in next minor release. |
static boolean |
closeReader(Reader reader)
Deprecated.
since the new feature try-with-resources statement this method gets
deprecated.
Note: This method will be removed in next minor release. |
static boolean |
closeWriter(Writer writer)
Deprecated.
since the new feature try-with-resources statement this method gets
deprecated.
Note: This method will be removed in next minor release. |
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 a
BufferedOutputStream from the given 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)
The Method writeInputStreamToOutputStream(InputStream, OutputStream, boolean) writes to the
given OutputStream from an opened InputStream.
|
static void |
writeInputStreamToOutputStream(InputStream inputStream,
OutputStream outputStream,
boolean closeStream)
Deprecated.
since the new feature try-with-resources statement this method gets deprecated.
Use instead the same name method without the flag closeStream.
Note: This method will be removed in next minor release. |
@Deprecated public static void close(InputStream in) throws IOException
in - The InputStream to close.IOException - Signals that an I/O exception has occurred.@Deprecated public static void close(OutputStream out) throws IOException
out - The OutputStream to close.IOException - Signals that an I/O exception has occurred.@Deprecated public static void close(Reader reader) throws IOException
reader - The Reader to close.IOException - Signals that an I/O exception has occurred.@Deprecated public static void close(Writer writer) throws IOException
writer - The Writer to close.IOException - Signals that an I/O exception has occurred.@Deprecated public static boolean closeInputStream(InputStream in)
in - The InputStream to close.@Deprecated public static boolean closeOutputStream(OutputStream out)
out - The OutputStream to close.@Deprecated public static boolean closeReader(Reader reader)
reader - The Reader to close.@Deprecated 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
BufferedOutputStream from the given File object.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.@Deprecated 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.public static void writeInputStreamToOutputStream(InputStream inputStream, OutputStream outputStream) throws IOException
inputStream - The opened InputStream.outputStream - The opened OutputStream.IOException - Signals that an I/O exception has occurred.Copyright © 2015–2018 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.