|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.portal.common.io.IOTools
public class IOTools
IO tools.
Field Summary | |
---|---|
static org.apache.log4j.Logger |
log
The logger. |
Constructor Summary | |
---|---|
IOTools()
|
Method Summary | ||
---|---|---|
static java.lang.Object |
clone(java.io.Serializable serializable)
Clone an object implementing the Serializable interface. |
|
static void |
copy(java.io.InputStream in,
java.io.OutputStream out)
|
|
static void |
copy(java.io.InputStream in,
java.io.OutputStream out,
int bufferSize)
Pipe an incoming stream in an outcoming stream until no bytes is available from the input stream. |
|
static void |
copy(java.io.Reader reader,
java.io.Writer writer)
Pipe an input stream in an output stream. |
|
static void |
copy(java.io.Reader reader,
java.io.Writer writer,
int bufferSize)
Pipe an incoming stream in an outcoming stream. |
|
static byte[] |
getBytes(java.io.InputStream in)
|
|
static byte[] |
getBytes(java.io.InputStream in,
int bufferSize)
Get the bytes from the provided input stream. |
|
static java.io.BufferedInputStream |
safeBufferedWrapper(java.io.InputStream in)
Check that the provided input stream is buffered. |
|
static java.io.BufferedOutputStream |
safeBufferedWrapper(java.io.OutputStream out)
Check that the provided output stream is buffered. |
|
static void |
safeClose(java.io.InputStream in)
Attempt to close an InputStream . |
|
static void |
safeClose(java.lang.Object closable)
Attempt to close an object. |
|
static void |
safeClose(java.io.OutputStream out)
Attempt to close an OutputStream . |
|
static void |
safeClose(java.io.Reader reader)
Attempt to close an Reader . |
|
static void |
safeClose(java.io.Writer writer)
Attempt to close an Writer . |
|
static byte[] |
serialize(java.io.Serializable serializable)
|
|
static
|
serialize(Serialization<T> serialization,
SerializationFilter filter,
T t)
|
|
static
|
serialize(Serialization<T> serialization,
T t)
|
|
static java.io.Serializable |
unserialize(byte[] bytes)
|
|
static
|
unserialize(Serialization<T> serialization,
byte[] bytes)
|
|
static
|
unserialize(Serialization<T> serialization,
SerializationFilter filter,
byte[] bytes)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.apache.log4j.Logger log
Constructor Detail |
---|
public IOTools()
Method Detail |
---|
public static void safeClose(java.lang.Object closable)
Attempt to close an object. Null argument value is authorized and no operation will be performed in that use case.
It will try to obtain a close()
method by reflection and it
will be invoked only if the method is public and not static. If the method is called, any Error
or RuntimeException
will be rethrown, any other kind of throwable will not be rethrown in any form.
closable
- the object to closepublic static void safeClose(java.io.OutputStream out)
Attempt to close an OutputStream
. Null argument value is authorized and no operation will be performed in that
use case.
out
- the stream to closepublic static void safeClose(java.io.InputStream in)
Attempt to close an InputStream
. Null argument value is authorized and no operation will be performed in that
use case.
in
- the stream to closepublic static void safeClose(java.io.Reader reader)
Attempt to close an Reader
. Null argument value is authorized and no operation will be performed in that
use case.
reader
- the stream to closepublic static void safeClose(java.io.Writer writer)
Attempt to close an Writer
. Null argument value is authorized and no operation will be performed in that
use case.
writer
- the stream to closepublic static byte[] getBytes(java.io.InputStream in) throws java.io.IOException, java.lang.IllegalArgumentException
in
- the input stream
java.io.IOException
java.lang.IllegalArgumentException
- if the input stream is nullgetBytes(java.io.InputStream, int)
public static byte[] getBytes(java.io.InputStream in, int bufferSize) throws java.io.IOException, java.lang.IllegalArgumentException
in
- the input streambufferSize
- the buffer size used to copy the bytes
java.io.IOException
java.lang.IllegalArgumentException
- if the input stream is null or the buffer size < 1public static void copy(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
in
- the incoming streamout
- the outcoming stream
java.lang.IllegalArgumentException
- if an argument is null
java.io.IOException
copy(java.io.InputStream, java.io.OutputStream, int)
public static void copy(java.io.InputStream in, java.io.OutputStream out, int bufferSize) throws java.io.IOException
in
- the incoming streamout
- the outcoming streambufferSize
- the buffer size
java.lang.IllegalArgumentException
- if bufferSize < 1 or an argument is null
java.io.IOException
public static void copy(java.io.Reader reader, java.io.Writer writer) throws java.io.IOException
reader
- the incoming readerwriter
- the outcoming writer
java.lang.IllegalArgumentException
- if an argument is null
java.io.IOException
public static void copy(java.io.Reader reader, java.io.Writer writer, int bufferSize) throws java.io.IOException
reader
- the incoming readerwriter
- the outcoming writerbufferSize
- the buffer size
java.lang.IllegalArgumentException
- if bufferSize < 1 or an argument is null
java.io.IOException
public static java.lang.Object clone(java.io.Serializable serializable) throws java.lang.IllegalArgumentException, java.io.IOException
Serializable
interface.
serializable
-
java.lang.IllegalArgumentException
- if the serializable object is null
java.io.IOException
public static byte[] serialize(java.io.Serializable serializable) throws java.lang.IllegalArgumentException, java.io.IOException
java.lang.IllegalArgumentException
java.io.IOException
public static java.io.Serializable unserialize(byte[] bytes) throws java.lang.IllegalArgumentException, java.io.IOException, java.lang.ClassNotFoundException
java.lang.IllegalArgumentException
java.io.IOException
java.lang.ClassNotFoundException
public static <T> byte[] serialize(Serialization<T> serialization, T t)
public static <T> byte[] serialize(Serialization<T> serialization, SerializationFilter filter, T t)
public static <T> T unserialize(Serialization<T> serialization, byte[] bytes)
public static <T> T unserialize(Serialization<T> serialization, SerializationFilter filter, byte[] bytes)
public static java.io.BufferedInputStream safeBufferedWrapper(java.io.InputStream in)
BufferedInputStream
no operation will be performed, otherwise a instance of BufferedInputStream
will be created and returned.
If the provided argument is null, the null value is returned.
in
- the stream
public static java.io.BufferedOutputStream safeBufferedWrapper(java.io.OutputStream out)
BufferedOutputStream
no operation will be performed, otherwise a instance of BufferedOutputStream
will be created and returned.
If the provided argument is null, the null value is returned.
out
- the stream
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |