JAPI 0.9.0
Yet another Java API
API Documentation

net.sf.japi.io
Class Copier

java.lang.Object
  extended by net.sf.japi.io.Copier
All Implemented Interfaces:
Runnable

public class Copier
extends Object
implements Runnable

A Runnable that copies from an InputStream to an OutputStream.

Author:
Christian Hujer

Field Summary
static boolean DEFAULT_AUTO_CLOSE
          Default automatic close.
static boolean DEFAULT_AUTO_FLUSH
          Default automatic flush.
static int DEFAULT_BUF_SIZE
          Default buffer size when copying.
 
Constructor Summary
Copier(InputStream in, OutputStream out)
          Create a Copier with default buffer size and autoFlush.
Copier(InputStream in, OutputStream out, int bufSize)
          Create a Copier with specified buffer size and automatic flush behaviour.
Copier(InputStream in, OutputStream out, int bufSize, boolean autoFlush, boolean autoClose)
          Create a Copier with specified buffer size and specified flush behaviour.
 
Method Summary
 void run()
          When an object implementing interface Runnable is used to create a thread, starting the thread causes the object's run method to be called in that separately executing thread.
 Thread start()
          Start the copier in a new thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUF_SIZE

public static final int DEFAULT_BUF_SIZE
Default buffer size when copying.

See Also:
Constant Field Values

DEFAULT_AUTO_FLUSH

public static final boolean DEFAULT_AUTO_FLUSH
Default automatic flush.

See Also:
Constant Field Values

DEFAULT_AUTO_CLOSE

public static final boolean DEFAULT_AUTO_CLOSE
Default automatic close.

See Also:
Constant Field Values
Constructor Detail

Copier

public Copier(InputStream in,
              OutputStream out)
Create a Copier with default buffer size and autoFlush.

Parameters:
in - the InputStream to read from
out - the OutputStream to write to

Copier

public Copier(InputStream in,
              OutputStream out,
              int bufSize)
Create a Copier with specified buffer size and automatic flush behaviour.

Parameters:
in - the InputStream to read from
out - the OutputStream to write to
bufSize - buffer size to use while copying

Copier

public Copier(InputStream in,
              OutputStream out,
              int bufSize,
              boolean autoFlush,
              boolean autoClose)
Create a Copier with specified buffer size and specified flush behaviour.

Parameters:
in - the InputStream to read from
out - the OutputStream to write to
bufSize - buffer size to use while copying
autoFlush - whether to flush automatically (true for automatic flush, false for flush on close)
autoClose - whether to close the streams automatically (true for automatic close, false for no close)
Method Detail

start

public Thread start()
Start the copier in a new thread.

Returns:
the newly created thread

run

public void run()
When an object implementing interface Runnable is used to create a thread, starting the thread causes the object's run method to be called in that separately executing thread.

The general contract of the method run is that it may take any action whatsoever.

Specified by:
run in interface Runnable
See Also:
Thread.run()

JAPI
Yet another Java API
API Documentation

© 2005-2006 Christian Hujer. All rights reserved. See copyright