public class StreamCopy
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_AUTO_FLUSH |
static boolean |
DEFAULT_CLOSE_AFTER_COPY |
Constructor and Description |
---|
StreamCopy() |
StreamCopy(boolean closeStreamsAfterCopy) |
StreamCopy(boolean closeStreamsAfterCopy,
IProgressListener listener) |
StreamCopy(int bufferSize) |
StreamCopy(int bufferSize,
boolean closeStreamsAfterCopy) |
StreamCopy(int bufferSize,
boolean closeStreamsAfterCopy,
IProgressListener listener) |
StreamCopy(int bufferSize,
IProgressListener listener) |
StreamCopy(IProgressListener listener) |
Modifier and Type | Method and Description |
---|---|
long |
copy(java.io.InputStream inStream,
java.io.OutputStream outStream)
Copies all data from the input stream to the output stream using
a buffer of the underlying defined size in bytes.
|
long |
copy(java.io.InputStream inStream,
java.io.OutputStream outStream,
java.lang.Long limit)
Copies all data from the input stream to the output stream using
a buffer of the underlying defined size in bytes.
|
static StreamCopy |
create()
Returns a new instance with default settings.
|
int |
getBufferSize() |
IProgressListener |
getProgressListener() |
protected IOUtil |
ioUtil() |
boolean |
isAutoFlush() |
boolean |
isCloseStreamsAfterCopy() |
StreamCopy |
setAutoFlush(boolean autoFlush)
Setting autoFlush to true means to flush the output stream
after each write of a buffer chunk.
|
StreamCopy |
setBufferSize(int bufferSize) |
StreamCopy |
setCloseStreamsAfterCopy(boolean closeStreamsAfterCopy) |
StreamCopy |
setProgressListener(IProgressListener listener) |
public static boolean DEFAULT_CLOSE_AFTER_COPY
public static boolean DEFAULT_AUTO_FLUSH
public StreamCopy()
public StreamCopy(IProgressListener listener)
public StreamCopy(int bufferSize)
public StreamCopy(boolean closeStreamsAfterCopy)
public StreamCopy(int bufferSize, IProgressListener listener)
public StreamCopy(boolean closeStreamsAfterCopy, IProgressListener listener)
public StreamCopy(int bufferSize, boolean closeStreamsAfterCopy)
public StreamCopy(int bufferSize, boolean closeStreamsAfterCopy, IProgressListener listener)
public static StreamCopy create()
public int getBufferSize()
public StreamCopy setBufferSize(int bufferSize)
public boolean isCloseStreamsAfterCopy()
public StreamCopy setCloseStreamsAfterCopy(boolean closeStreamsAfterCopy)
public IProgressListener getProgressListener()
public StreamCopy setProgressListener(IProgressListener listener)
public boolean isAutoFlush()
public StreamCopy setAutoFlush(boolean autoFlush)
public long copy(java.io.InputStream inStream, java.io.OutputStream outStream) throws java.io.IOException
inStream
- The source stream.outStream
- The target stream.java.io.IOException
public long copy(java.io.InputStream inStream, java.io.OutputStream outStream, java.lang.Long limit) throws java.io.IOException
inStream
- The source stream.outStream
- The target stream.limit
- The maximum number of bytes that will be copied. If exceeded an IOException will be thrown.
Setting this parameter to null, zero or a negative value will specify no limit.java.io.IOException
protected IOUtil ioUtil()