org.sonatype.gshell.util.io
Class Copier

java.lang.Object
  extended by org.sonatype.gshell.util.io.Copier

public class Copier
extends Object

Stream/Reader/Writer copy helpers. Based on plexus-utils IOUtil.

Since:
2.6.4
Author:
Jason Dillon

Constructor Summary
Copier()
           
 
Method Summary
static void copy(InputStream input, OutputStream output)
          Copy bytes from an InputStream to an OutputStream.
static void copy(InputStream input, OutputStream output, int bufferSize)
          Copy bytes from an InputStream to an OutputStream.
static void copy(InputStream input, Writer output)
          Copy and convert bytes from an InputStream to chars on a Writer.
static void copy(InputStream input, Writer output, int bufferSize)
          Copy and convert bytes from an InputStream to chars on a Writer.
static void copy(InputStream input, Writer output, String encoding)
          Copy and convert bytes from an InputStream to chars on a Writer, using the specified encoding.
static void copy(InputStream input, Writer output, String encoding, int bufferSize)
          Copy and convert bytes from an InputStream to chars on a Writer, using the specified encoding.
static void copy(Reader input, Writer output)
          Copy chars from a Reader to a Writer.
static void copy(Reader input, Writer output, int bufferSize)
          Copy chars from a Reader to a Writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Copier

public Copier()
Method Detail

copy

public static void copy(InputStream input,
                        OutputStream output)
                 throws IOException
Copy bytes from an InputStream to an OutputStream.

Throws:
IOException

copy

public static void copy(InputStream input,
                        OutputStream output,
                        int bufferSize)
                 throws IOException
Copy bytes from an InputStream to an OutputStream.

Parameters:
bufferSize - Size of internal buffer to use.
Throws:
IOException

copy

public static void copy(Reader input,
                        Writer output)
                 throws IOException
Copy chars from a Reader to a Writer.

Throws:
IOException

copy

public static void copy(Reader input,
                        Writer output,
                        int bufferSize)
                 throws IOException
Copy chars from a Reader to a Writer.

Parameters:
bufferSize - Size of internal buffer to use.
Throws:
IOException

copy

public static void copy(InputStream input,
                        Writer output)
                 throws IOException
Copy and convert bytes from an InputStream to chars on a Writer. The platform's default encoding is used for the byte-to-char conversion.

Throws:
IOException

copy

public static void copy(InputStream input,
                        Writer output,
                        int bufferSize)
                 throws IOException
Copy and convert bytes from an InputStream to chars on a Writer. The platform's default encoding is used for the byte-to-char conversion.

Parameters:
bufferSize - Size of internal buffer to use.
Throws:
IOException

copy

public static void copy(InputStream input,
                        Writer output,
                        String encoding)
                 throws IOException
Copy and convert bytes from an InputStream to chars on a Writer, using the specified encoding.

Parameters:
encoding - The name of a supported character encoding. See the IANA Charset Registry for a list of valid encoding types.
Throws:
IOException

copy

public static void copy(InputStream input,
                        Writer output,
                        String encoding,
                        int bufferSize)
                 throws IOException
Copy and convert bytes from an InputStream to chars on a Writer, using the specified encoding.

Parameters:
encoding - The name of a supported character encoding. See the IANA Charset Registry for a list of valid encoding types.
bufferSize - Size of internal buffer to use.
Throws:
IOException


Copyright © 2008-2011 Sonatype. All Rights Reserved.