|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.ode.utils.StreamUtils
public class StreamUtils
Utilities for dealing with byte (InputStream
and
OutputStream
) and character (Reader
and
Writer
) streams.
Field Summary | |
---|---|
static int |
DEFAULT_BUFFER_SIZE
The default size of the byte buffer used in the copy(java.io.OutputStream, java.io.InputStream, int) methods. |
Constructor Summary | |
---|---|
StreamUtils()
|
Method Summary | |
---|---|
static void |
copy(java.io.OutputStream dest,
java.io.InputStream source)
Copy with default buffer size. |
static void |
copy(java.io.OutputStream dest,
java.io.InputStream source,
int bufSize)
Copy data from an InputStream to an OutputStream until an
end-of-stream is reached on the source InputStream . |
static void |
copy(java.io.OutputStream dest,
java.net.URL source)
Copy from URL stream. |
static void |
copy(java.io.Writer dest,
java.io.Reader source,
int bufSize)
Copy data from an Reader to an Writer until an
end-of-stream is reached on the source Reader . |
static void |
extractJar(java.io.File dest,
java.io.InputStream is)
Expand a Jar input stream. |
static byte[] |
read(java.io.InputStream source)
Read the contents of the given InputStream into a byte array. |
static byte[] |
read(java.net.URL input)
Read the contents of the given URL into a byte array. |
static java.lang.Object |
readObj(java.io.InputStream is)
|
static void |
write(java.io.OutputStream dest,
java.io.Serializable src)
Write a Serializable object to an output stream using the
ObjectOutputStream mechanism. |
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_SIZE
copy(java.io.OutputStream, java.io.InputStream, int)
methods.
Constructor Detail |
---|
public StreamUtils()
Method Detail |
---|
public static byte[] read(java.net.URL input) throws java.io.IOException
input
- the URL to read
java.io.IOException
- in case of I/O errorpublic static byte[] read(java.io.InputStream source) throws java.io.IOException
input
- the InputStream to read
java.io.IOException
- in case of I/O errorpublic static void copy(java.io.OutputStream dest, java.io.InputStream source, int bufSize) throws java.io.IOException
InputStream
to an OutputStream
until an
end-of-stream is reached on the source InputStream
. This method
does not attempt to close either the source or the destination
stream.
dest
- destination OutputStream
source
- source InputStream
bufSize
- write buffer size
java.io.IOException
- in case of I/O errorpublic static void copy(java.io.Writer dest, java.io.Reader source, int bufSize) throws java.io.IOException
Reader
to an Writer
until an
end-of-stream is reached on the source Reader
. This method does
not attempt to close either the source or the destination
stream.
dest
- destination Writer
source
- source Reader
bufSize
- write buffer size
java.io.IOException
- in case of I/O errorpublic static void copy(java.io.OutputStream dest, java.io.InputStream source) throws java.io.IOException
java.io.IOException
copy(java.io.OutputStream, java.io.InputStream)
,
DEFAULT_BUFFER_SIZE
public static void copy(java.io.OutputStream dest, java.net.URL source) throws java.io.IOException
URL
stream.
dest
- destination OutputStream
source
- source URL
java.io.IOException
copy(java.io.OutputStream, java.io.InputStream, int)
public static void write(java.io.OutputStream dest, java.io.Serializable src) throws java.io.IOException
Serializable
object to an output stream using the
ObjectOutputStream
mechanism.
dest
- destination OutputStream
src
- source Serializable
java.io.IOException
public static java.lang.Object readObj(java.io.InputStream is) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public static void extractJar(java.io.File dest, 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 |