Commons Compress 1.5-redhat-1

org.apache.commons.compress.utils
Class IOUtils

java.lang.Object
  extended by org.apache.commons.compress.utils.IOUtils

public final class IOUtils
extends Object

Utility functions

This class is immutable

Method Summary
static long copy(InputStream input, OutputStream output)
          Copies the content of a InputStream into an OutputStream.
static long copy(InputStream input, OutputStream output, int buffersize)
          Copies the content of a InputStream into an OutputStream
static byte[] toByteArray(InputStream input)
          Gets the contents of an InputStream as a byte[].
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

copy

public static long copy(InputStream input,
                        OutputStream output)
                 throws IOException
Copies the content of a InputStream into an OutputStream. Uses a default buffer size of 8024 bytes.

Parameters:
input - the InputStream to copy
output - the target Stream
Throws:
IOException - if an error occurs

copy

public static long copy(InputStream input,
                        OutputStream output,
                        int buffersize)
                 throws IOException
Copies the content of a InputStream into an OutputStream

Parameters:
input - the InputStream to copy
output - the target Stream
buffersize - the buffer size to use
Throws:
IOException - if an error occurs

toByteArray

public static byte[] toByteArray(InputStream input)
                          throws IOException
Gets the contents of an InputStream as a byte[].

This method buffers the input internally, so there is no need to use a BufferedInputStream.

Parameters:
input - the InputStream to read from
Returns:
the requested byte array
Throws:
NullPointerException - if the input is null
IOException - if an I/O error occurs
Since:
1.5

Commons Compress 1.5-redhat-1

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.