|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.commons.util.io.StreamUtil
public class StreamUtil
Utilities for working with streams
Constructor Summary | |
---|---|
StreamUtil()
|
Method Summary | |
---|---|
static java.io.InputStream |
close(java.io.InputStream s)
Call close on an input stream and ignore any exception. |
static java.io.OutputStream |
close(java.io.OutputStream s)
Call close on an output stream and ignore any exception. |
static java.io.Reader |
close(java.io.Reader r)
Call close on a Reader and ignore any exception. |
static java.io.Writer |
close(java.io.Writer w)
Call close on a Writer and ignore any exception. |
static long |
copyStream(java.io.InputStream is,
java.io.OutputStream os)
Copy contents of one stream onto another |
static long |
copyStream(java.io.InputStream is,
java.io.OutputStream os,
int bufferSize)
Copy contents of one stream onto another |
static long |
copyStream(java.io.Reader is,
java.io.Writer os)
Copy contents of one stream onto another |
static long |
copyStream(java.io.Reader is,
java.io.Writer os,
int bufferSize)
Copy contents of one character stream onto another |
static int |
fillBuffer(byte[] buffer,
java.io.InputStream is)
Fill a buffer as much as we can from InputStream. |
static java.lang.String |
readString(java.io.InputStream is)
Read a string from an input stream using the default encoding. |
static java.lang.String |
readString(java.io.InputStream is,
java.lang.String encoding)
Read a string from an input stream using a specific encoding. |
static java.lang.String |
readString(java.io.Reader reader)
Read a string from a reader. |
static java.lang.String |
readUTF(java.io.ObjectInput in)
Read a UTF string as written by writeUTF. |
static void |
writeUTF(java.io.ObjectOutput out,
java.lang.String s)
Writes a UTF string to be read by readUTF(). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StreamUtil()
Method Detail |
---|
public static java.io.OutputStream close(java.io.OutputStream s)
s
- the stream to call .close() on
public static java.io.InputStream close(java.io.InputStream s)
s
- the stream to call .close() on
public static java.io.Writer close(java.io.Writer w)
s
- the Writer to call .close() on
public static java.io.Reader close(java.io.Reader r)
s
- the Reader to call .close() on
public static long copyStream(java.io.InputStream is, java.io.OutputStream os) throws java.io.IOException
is
- input streamos
- output stream
java.io.IOException
public static long copyStream(java.io.InputStream is, java.io.OutputStream os, int bufferSize) throws java.io.IOException
is
- input streamos
- output streambufferSize
- size of buffer to use for copy
Note: there are cases where InputStream.available() returns > 0 but in
actual fact the stream won't be able to read anything, so we need to
handle the fact that InputStream.read() may return -1
java.io.IOException
public static long copyStream(java.io.Reader is, java.io.Writer os) throws java.io.IOException
is
- input streamos
- output stream
java.io.IOException
public static long copyStream(java.io.Reader is, java.io.Writer os, int bufferSize) throws java.io.IOException
is
- input streamos
- output streambufferSize
- size of buffer to use for copy
Note: there are cases where InputStream.available() returns > 0 but in
actual fact the stream won't be able to read anything, so we need to
handle the fact that InputStream.read() may return -1
java.io.IOException
public static java.lang.String readUTF(java.io.ObjectInput in) throws java.io.IOException
java.io.IOException
public static void writeUTF(java.io.ObjectOutput out, java.lang.String s) throws java.io.IOException
java.io.IOException
public static java.lang.String readString(java.io.Reader reader) throws java.io.IOException
java.io.IOException
public static java.lang.String readString(java.io.InputStream is) throws java.io.IOException
java.io.IOException
public static java.lang.String readString(java.io.InputStream is, java.lang.String encoding) throws java.io.IOException
java.io.IOException
public static int fillBuffer(byte[] buffer, java.io.InputStream is) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |