|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecteu.beesoft.gaia.util.Streams
public final class Streams
Utility class for the stream I/O operations.
Method Summary | |
---|---|
static void |
close(java.io.InputStream input)
Closes given input stream. |
static void |
close(java.io.OutputStream output)
Closes given output stream. |
static void |
copy(java.io.InputStream input,
java.io.OutputStream output)
Copies all data from input stream to output stream. |
static byte[] |
copyToByteArray(java.io.InputStream input)
Copies all data from input stream to the returned byte array. |
static java.io.InputStream |
getInputStream(java.io.File resource)
Returns an input stream from a given File resource . |
static java.io.InputStream |
getInputStream(java.lang.String resource)
Returns an input stream for given resource . |
static java.io.OutputStream |
getOutputStream(java.io.File file)
Returns an output stream for a given file . |
static java.io.OutputStream |
getOutputStream(java.lang.String fileName)
Returns an output stream for a file with given fileName . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.io.InputStream getInputStream(java.lang.String resource)
resource
. First it tries
to get input stream from a file on the file-system level. If such file
does not exist, it edits name (adds or removes initial slash) and repeats
previous step. If there is no file found, it tries to get input stream
via Class.getResourceAsStream() method for original and if not
successfull for edited name, too.
resource
- - a resource name
java.lang.NullPointerException
- if resource is null
java.lang.RuntimeException
- if cannot create an input stream from an existing filepublic static java.io.InputStream getInputStream(java.io.File resource)
resource
.
resource
- - a File instance
java.lang.NullPointerException
- if resource is null
java.lang.RuntimeException
- if cannot create an input stream from existing filepublic static java.io.OutputStream getOutputStream(java.lang.String fileName)
fileName
.
fileName
- - a file name
public static java.io.OutputStream getOutputStream(java.io.File file)
file
.
file
- - a File instance
public static void copy(java.io.InputStream input, java.io.OutputStream output)
input
- - an input streamoutput
- - an output stream
java.lang.RuntimeException
- if some exception was thrownpublic static byte[] copyToByteArray(java.io.InputStream input)
input
- - an input stream
java.lang.RuntimeException
- if some exception was thrownpublic static void close(java.io.InputStream input)
input
stream. No exception is thrown if some
problem occurrs.
input
- - an input stream to closepublic static void close(java.io.OutputStream output)
output
stream. No exception is thrown if some
problem occurrs.
output
- - an output stream to close
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |