|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.enough.polish.util.StreamUtil
public class StreamUtil
Provides some useful Stream methods.
Copyright Enough Software 2008
history
10-Jul-2008 - asc creation
| Field Summary | |
|---|---|
static int |
DEFAULT_BUFFER
the default length for the temporary buffer is 8 kb |
| Constructor Summary | |
|---|---|
StreamUtil()
|
|
| Method Summary | |
|---|---|
static String[] |
getLines(InputStream in,
String encoding,
int bufferLength)
Returns the lines of a InputStream as an ArrayList of Strings |
static String |
getString(InputStream in)
Returns the content of a stream as a String |
static String |
getString(InputStream in,
String encoding,
int bufferLength)
Returns the content of a stream as a String |
static String |
getStringSafe(InputStream in)
Returns the content of a stream as a String |
static String |
getStringSafe(InputStream in,
String encoding,
int bufferLength)
Returns the content of a stream as a String |
static byte[] |
readFully(InputStream in)
Reads the complete input stream into a byte array using a 8kb temporary buffer |
static byte[] |
readFully(InputStream in,
byte[] buffer)
Reads the complete input stream into a byte array using the specified buffer |
static byte[] |
readFully(InputStream in,
int bufferLength)
Reads the complete input stream into a byte array using the specified buffer size |
static byte[] |
readFullySafe(InputStream in)
Reads the complete input stream into a byte array using a 8kb temporary buffer The input stream is read until it is empty or until an error occurred. |
static byte[] |
readFullySafe(InputStream in,
byte[] buffer)
Reads the complete input stream into a byte array using a the specified buffer. |
static byte[] |
readFullySafe(InputStream in,
int bufferLength)
Reads the complete input stream into a byte array using a the specified buffer size. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_BUFFER
| Constructor Detail |
|---|
public StreamUtil()
| Method Detail |
|---|
public static String[] getLines(InputStream in,
String encoding,
int bufferLength)
throws IOException
in - the stream to readencoding - the encoding to usebufferLength - the length of the used temporary buffer
IOException - when reading fails
NullPointerException - when the given input stream is null
public static String getString(InputStream in)
throws IOException
in - the stream to read with the text in the default encoding
IOException - when reading fails
public static String getString(InputStream in,
String encoding,
int bufferLength)
throws IOException
in - the stream to readencoding - the encoding to usebufferLength - the length of the used temporary buffer
IOException - when reading fails
NullPointerException - when the given input stream is nullpublic static String getStringSafe(InputStream in)
in - the stream to read with the text in the default encoding
public static String getStringSafe(InputStream in,
String encoding,
int bufferLength)
in - the stream to readencoding - the encoding to usebufferLength - the length of the used temporary buffer
public static byte[] readFully(InputStream in)
throws IOException
in - the input stream
IOException - when reading fails
NullPointerException - when the given input stream is null
public static byte[] readFully(InputStream in,
int bufferLength)
throws IOException
in - the input streambufferLength - the length of the used temporary buffer
IOException - when reading fails
NullPointerException - when the given input stream is null
public static byte[] readFully(InputStream in,
byte[] buffer)
throws IOException
in - the input streambuffer - the used temporary buffer
IOException - when reading fails
NullPointerException - when the given input stream is nullpublic static byte[] readFullySafe(InputStream in)
in - the input stream
public static byte[] readFullySafe(InputStream in,
int bufferLength)
in - the input streambufferLength - the length of the used temporary buffer
public static byte[] readFullySafe(InputStream in,
byte[] buffer)
in - the input streambuffer - the used temporary buffer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||