org.apache.camel.util
Class IOHelper

java.lang.Object
  extended by org.apache.camel.util.IOHelper

public final class IOHelper
extends Object

IO helper class.

Version:

Method Summary
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.
static IOException createIOException(Throwable cause)
          Deprecated. IOException support nested exception in Java 1.6.
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newStringFromBytes

public static String newStringFromBytes(byte[] bytes)
Use this function instead of new String(byte[]) to avoid surprises from non-standard default encodings.


newStringFromBytes

public 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.


createIOException

@Deprecated
public static IOException createIOException(Throwable cause)
Deprecated. IOException support nested exception in Java 1.6.

A factory method which creates an IOException from the given exception and message


createIOException

@Deprecated
public static IOException createIOException(String message,
                                                       Throwable cause)
Deprecated. IOException support nested exception in Java 1.6.

A factory method which creates an IOException from the given exception and message


copy

public static int copy(InputStream input,
                       OutputStream output)
                throws IOException
Throws:
IOException

copy

public static int copy(InputStream input,
                       OutputStream output,
                       int bufferSize)
                throws IOException
Throws:
IOException

copyAndCloseInput

public static void copyAndCloseInput(InputStream input,
                                     OutputStream output)
                              throws IOException
Throws:
IOException

copyAndCloseInput

public static void copyAndCloseInput(InputStream input,
                                     OutputStream output,
                                     int bufferSize)
                              throws IOException
Throws:
IOException

close

public 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

Parameters:
closeable - the object to close
name - the name of the resource
log - the log to use when reporting closure warnings

close

public static void close(Closeable closeable,
                         String name)
Closes the given resource if it is available.

Parameters:
closeable - the object to close
name - the name of the resource

close

public static void close(Closeable closeable)
Closes the given resource if it is available.

Parameters:
closeable - the object to close


Apache CAMEL