public final class StreamExtensions extends Object implements Serializable
| Constructor and Description |
|---|
StreamExtensions() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
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.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–2019 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.