public interface IOCopier
Implementation should be designed for a single copy task; they are thrown
away and garbage collected after the copy is complete. Partial or
fixed-length copies are allowed via the copy(long) method. Full
copies are done by the copy(). Closing of the streams is optional,
and should be performed by the close() method.
Typical usage is:
copier = new StreamCopier(input, output); copier.copy(); copier.close();
Copyright 2006 Partner Software, Inc.
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes input source and output sink.
|
long |
copy()
Copies all available data from the source to the sink.
|
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.
|
long copy()
throws java.io.IOException
java.io.IOException - if something prevents the copylong copyWithoutBlocking()
throws java.io.IOException
This method is optional, if it's not appropriate for the kind of copy, throws an UnsupportedOperationException.
java.io.IOExceptionlong copyBlockingOnce()
throws java.io.IOException
This method is optional, if it's not appropriate for the kind of copy, throws an UnsupportedOperationException.
java.io.IOExceptionlong copy(long howMuch)
throws java.io.IOException
howMuch - how many items (bytes, characters, etc.) to copyjava.io.IOException - if something prevents the copy or if there are not enough
items to copyvoid close()
throws java.io.IOException
java.io.IOException - if anything prevents closing.