public class DataCopier extends java.lang.Object implements IOCopier
DataInput to a DataOutput.
Typical usage:
input = new DataDataInput(new FileDataInput(FileLib
.createFile("data/copyfrom.dat")));
output = new DataDataOutput(new FileDataOutput(FileLib
.createFile("data/copyto.dat")));
copier = new DataCopier(input, output);
copier.copy();
copier.close();
Copyright 2006 Partner Software, Inc.
| Constructor and Description |
|---|
DataCopier(java.io.DataInput source,
java.io.DataOutput sink)
Constructs a DataCopier for the given source and sink with standard
buffer size and no specified data size.
|
DataCopier(java.io.DataInput source,
java.io.DataOutput sink,
int bufferSize)
Constructs a DataCopier for the given source and sink with the given
buffer size and no specified data size.
|
DataCopier(java.io.DataInput source,
long dataSize,
java.io.DataOutput sink)
Constructs a DataCopier for the given source, data size and sink with
standard buffer size.
|
DataCopier(java.io.DataInput source,
long dataSize,
java.io.DataOutput sink,
int bufferSize)
Constructs a DataCopier for the given source, sink, data size, and buffer
size.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
DataInput and DataOutput do not define flushing or closing methods, so
this method does nothing.
|
long |
copy()
If dataSize is set, copies that amount.
|
long |
copy(long howMuch)
Copies the specified amount of data from the source to the sink.
|
long |
copyBlockingOnce()
Block only once, copying available data, but quit as soon as a block would occur.
|
long |
copyWithoutBlocking()
Copies only available data.
|
public DataCopier(java.io.DataInput source,
long dataSize,
java.io.DataOutput sink,
int bufferSize)
copy() doesn't know when to stop without causing an exception.
The data size can be set to java.lang.Long.MAX_VALUE if you don't
plan on using copy().public DataCopier(java.io.DataInput source,
long dataSize,
java.io.DataOutput sink)
IOConstants.BUFFER_SIZEpublic DataCopier(java.io.DataInput source,
java.io.DataOutput sink,
int bufferSize)
public DataCopier(java.io.DataInput source,
java.io.DataOutput sink)
IOConstants.BUFFER_SIZEpublic long copy()
throws java.io.IOException
public long copy(long howMuch)
throws java.io.IOException
IOCopierpublic long copyWithoutBlocking()
throws java.io.IOException
IOCopierThis method is optional, if it's not appropriate for the kind of copy, throws an UnsupportedOperationException.
copyWithoutBlocking in interface IOCopierjava.io.IOExceptionpublic long copyBlockingOnce()
throws java.io.IOException
IOCopierThis method is optional, if it's not appropriate for the kind of copy, throws an UnsupportedOperationException.
copyBlockingOnce in interface IOCopierjava.io.IOException