Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Apache CXF API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cxf.helpers
Class IOUtils

    java.lang.Object
      org.apache.cxf.helpers.IOUtils

    public final class IOUtils

extends Object

Field Summary
`static Charset` | `UTF8_CHARSET`

Method Summary
`static void` | `consume(InputStream in)`
`static void` | `consume(InputStream input, int atLeast)` Consumes at least the given number of bytes from the input stream
`static int` | `copy(InputStream input, OutputStream output)`
`static int` | `copy(InputStream input, OutputStream output, int bufferSize)`
`static void` | `copy(Reader input, Writer output, int bufferSize)`
`static int` | `copyAndCloseInput(InputStream input, OutputStream output)`
`static int` | `copyAndCloseInput(InputStream input, OutputStream output, int bufferSize)`
`static void` | `copyAtLeast(InputStream input, OutputStream output, int atLeast)` Copy at least the specified number of bytes from the input to the output or until the inputstream is finished.
`static ByteArrayInputStream` | `loadIntoBAIS(InputStream in)` Load the InputStream into memory and return a ByteArrayInputStream that represents it.
`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` | `newStringFromBytes(byte[] bytes, String charsetName)` Use this function instead of new String(byte[], String) to avoid surprises from non-standard default encodings.
`static String` | `newStringFromBytes(byte[] bytes, String charsetName, int start, int length)` Use this function instead of new String(byte[], int, int, String) to avoid surprises from non-standard default encodings.
`static byte[]` | `readBytesFromStream(InputStream in)`
`static String` | `readStringFromStream(InputStream in)`
`static String` | `toString(InputStream input)`
`static String` | `toString(InputStream input, int bufferSize)`
`static String` | `toString(InputStream input, int bufferSize, String charset)`
`static String` | `toString(InputStream input, String charset)`
`static String` | `toString(Reader input)`
`static String` | `toString(Reader input, int bufSize)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### UTF8_CHARSET

    public static final Charset UTF8_CHARSET

Method Detail

### newStringFromBytes

    public static String newStringFromBytes(byte[] bytes,
                                            String charsetName)

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

  Parameters:
    `bytes` -
    `charsetName` -
  Returns:

### newStringFromBytes

    public static String newStringFromBytes(byte[] bytes)

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

  Parameters:
    `bytes` -
  Returns:

### newStringFromBytes

    public static String newStringFromBytes(byte[] bytes,
                                            String charsetName,
                                            int start,
                                            int length)

  Use this function instead of new String(byte[], int, int, String) to avoid surprises from non-standard default encodings.

  Parameters:
    `bytes` -
    `charsetName` -
    `start` -
    `length` -
  Returns:

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

  Parameters:
    `bytes` -
    `start` -
    `length` -
  Returns:

### copy

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

  Throws:
    `IOException`

### copyAndCloseInput

    public static int copyAndCloseInput(InputStream input,
                                        OutputStream output)
                                 throws IOException

  Throws:
    `IOException`

### copyAndCloseInput

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

  Throws:
    `IOException`

### copy

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

  Throws:
    `IOException`

### copyAtLeast

    public static void copyAtLeast(InputStream input,
                                   OutputStream output,
                                   int atLeast)
                            throws IOException

  Copy at least the specified number of bytes from the input to the output or until the inputstream is finished.

  Parameters:
    `input` -
    `output` -
    `atLeast` -
  Throws:
    `IOException`

### copy

    public static void copy(Reader input,
                            Writer output,
                            int bufferSize)
                     throws IOException

  Throws:
    `IOException`

### toString

    public static String toString(InputStream input)
                           throws IOException

  Throws:
    `IOException`

### toString

    public static String toString(InputStream input,
                                  String charset)
                           throws IOException

  Throws:
    `IOException`

### toString

    public static String toString(InputStream input,
                                  int bufferSize)
                           throws IOException

  Throws:
    `IOException`

### toString

    public static String toString(InputStream input,
                                  int bufferSize,
                                  String charset)
                           throws IOException

  Throws:
    `IOException`

### toString

    public static String toString(Reader input)
                           throws IOException

  Throws:
    `IOException`

### toString

    public static String toString(Reader input,
                                  int bufSize)
                           throws IOException

  Throws:
    `IOException`

### readStringFromStream

    public static String readStringFromStream(InputStream in)
                                       throws IOException

  Throws:
    `IOException`

### loadIntoBAIS

    public static ByteArrayInputStream loadIntoBAIS(InputStream in)
                                             throws IOException

  Load the InputStream into memory and return a ByteArrayInputStream that represents it. Closes the in stream.

  Parameters:
    `in` -
  Returns:
  Throws:
    `IOException`

### consume

    public static void consume(InputStream in)
                        throws IOException

  Throws:
    `IOException`

### consume

    public static void consume(InputStream input,
                               int atLeast)
                        throws IOException

  Consumes at least the given number of bytes from the input stream

  Parameters:
    `input` -
    `atLeast` -
  Throws:
    `IOException`

### readBytesFromStream

    public static byte[] readBytesFromStream(InputStream in)
                                      throws IOException

  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Apache CXF API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Apache CXF