|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.camel.util.IOHelper
public final class IOHelper
IO helper class.
Method Summary | |
---|---|
static BufferedInputStream |
buffered(InputStream in)
Wraps the passed in into a BufferedInputStream
object and returns that. |
static BufferedOutputStream |
buffered(OutputStream out)
Wraps the passed out into a BufferedOutputStream
object and returns that. |
static BufferedReader |
buffered(Reader reader)
Wraps the passed reader into a BufferedReader object
and returns that. |
static BufferedWriter |
buffered(Writer writer)
Wraps the passed writer into a BufferedWriter object
and returns that. |
static void |
close(Closeable closeable)
Closes the given resource if it is available. |
static void |
close(Closeable closeable,
String name)
Closes the given resource if it is available. |
static void |
close(Closeable closeable,
String name,
org.slf4j.Logger log)
Closes the given resource if it is available, logging any closing exceptions to the given log |
static int |
copy(InputStream input,
OutputStream output)
|
static int |
copy(InputStream input,
OutputStream output,
int bufferSize)
|
static void |
copyAndCloseInput(InputStream input,
OutputStream output)
|
static void |
copyAndCloseInput(InputStream input,
OutputStream output,
int bufferSize)
|
static IOException |
createIOException(String message,
Throwable cause)
Deprecated. IOException support nested exception in Java 1.6. Will be removed in Camel 3.0 |
static IOException |
createIOException(Throwable cause)
Deprecated. IOException support nested exception in Java 1.6. Will be removed in Camel 3.0 |
static void |
force(FileChannel channel,
String name,
org.slf4j.Logger log)
Forces any updates to this channel's file to be written to the storage device that contains it. |
static String |
getCharsetName(Exchange exchange)
|
static String |
getCharsetName(Exchange exchange,
boolean useDefault)
Gets the charset name if set as property Exchange.CHARSET_NAME . |
static String |
newStringFromBytes(byte[] bytes)
Use this function instead of new String(byte[]) to avoid surprises from non-standard default encodings. |
static String |
newStringFromBytes(byte[] bytes,
int start,
int length)
Use this function instead of new String(byte[], int, int) to avoid surprises from non-standard default encodings. |
static String |
normalizeCharset(String charset)
This method will take off the quotes and double quotes of the charset |
static void |
validateCharset(String charset)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static String newStringFromBytes(byte[] bytes)
public static String newStringFromBytes(byte[] bytes, int start, int length)
public static BufferedInputStream buffered(InputStream in)
in
into a BufferedInputStream
object and returns that. If the passed in
is already an
instance of BufferedInputStream
returns the same passed
in
reference as is (avoiding double wrapping).
in
- the wrapee to be used for the buffering support
in
decorated through a
BufferedInputStream
object as wrapperpublic static BufferedOutputStream buffered(OutputStream out)
out
into a BufferedOutputStream
object and returns that. If the passed out
is already an
instance of BufferedOutputStream
returns the same passed
out
reference as is (avoiding double wrapping).
out
- the wrapee to be used for the buffering support
out
decorated through a
BufferedOutputStream
object as wrapperpublic static BufferedReader buffered(Reader reader)
reader
into a BufferedReader
object
and returns that. If the passed reader
is already an
instance of BufferedReader
returns the same passed
reader
reference as is (avoiding double wrapping).
reader
- the wrapee to be used for the buffering support
reader
decorated through a
BufferedReader
object as wrapperpublic static BufferedWriter buffered(Writer writer)
writer
into a BufferedWriter
object
and returns that. If the passed writer
is already an
instance of BufferedWriter
returns the same passed
writer
reference as is (avoiding double wrapping).
writer
- the wrapee to be used for the buffering support
writer
decorated through a
BufferedWriter
object as wrapper@Deprecated public static IOException createIOException(Throwable cause)
IOException
from the given
exception and message
@Deprecated public static IOException createIOException(String message, Throwable cause)
IOException
from the given
exception and message
public static int copy(InputStream input, OutputStream output) throws IOException
IOException
public static int copy(InputStream input, OutputStream output, int bufferSize) throws IOException
IOException
public static void copyAndCloseInput(InputStream input, OutputStream output) throws IOException
IOException
public static void copyAndCloseInput(InputStream input, OutputStream output, int bufferSize) throws IOException
IOException
public static void force(FileChannel channel, String name, org.slf4j.Logger log)
channel
- the file channelname
- the name of the resourcelog
- the log to use when reporting closure warningspublic static void close(Closeable closeable, String name, org.slf4j.Logger log)
closeable
- the object to closename
- the name of the resourcelog
- the log to use when reporting closure warningspublic static void close(Closeable closeable, String name)
closeable
- the object to closename
- the name of the resourcepublic static void close(Closeable closeable)
closeable
- the object to closepublic static void validateCharset(String charset) throws UnsupportedCharsetException
UnsupportedCharsetException
public static String normalizeCharset(String charset)
public static String getCharsetName(Exchange exchange)
public static String getCharsetName(Exchange exchange, boolean useDefault)
Exchange.CHARSET_NAME
.
exchange
- the exchangeuseDefault
- should we fallback and use JVM default charset if no property existed?
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |