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:
$Revision: 19409 $

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.apache.commons.logging.Log 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)
          A factory method which creates an IOException from the given exception and message
static IOException createIOException(Throwable cause)
          A factory method which creates an IOException from the given exception and message
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

public static IOException createIOException(Throwable cause)
A factory method which creates an IOException from the given exception and message


createIOException

public static IOException createIOException(String message,
                                            Throwable cause)
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.apache.commons.logging.Log 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