| java.lang.Object org.apache.commons.net.io.Util
Method Summary | |
final public static long | copyReader(Reader source, Writer dest, int bufferSize, long streamSize, CopyStreamListener listener) Copies the contents of a Reader to a Writer using a
copy buffer of a given size and notifies the provided
CopyStreamListener of the progress of the copy operation by calling
its bytesTransferred(long, int) method after each write to the
destination. | final public static long | copyReader(Reader source, Writer dest, int bufferSize) Copies the contents of a Reader to a Writer using a
copy buffer of a given size. | final public static long | copyReader(Reader source, Writer dest) | final public static long | copyStream(InputStream source, OutputStream dest, int bufferSize, long streamSize, CopyStreamListener listener, boolean flush) Copies the contents of an InputStream to an OutputStream using a
copy buffer of a given size and notifies the provided
CopyStreamListener of the progress of the copy operation by calling
its bytesTransferred(long, int) method after each write to the
destination. | final public static long | copyStream(InputStream source, OutputStream dest, int bufferSize, long streamSize, CopyStreamListener listener) Copies the contents of an InputStream to an OutputStream using a
copy buffer of a given size and notifies the provided
CopyStreamListener of the progress of the copy operation by calling
its bytesTransferred(long, int) method after each write to the
destination. | final public static long | copyStream(InputStream source, OutputStream dest, int bufferSize) Copies the contents of an InputStream to an OutputStream using a
copy buffer of a given size. | final public static long | copyStream(InputStream source, OutputStream dest) |
DEFAULT_COPY_BUFFER_SIZE | final public static int DEFAULT_COPY_BUFFER_SIZE(Code) | | The default buffer size used by
Util.copyStream copyStream and
Util.copyReader copyReader . It's value is 1024.
|
copyReader | final public static long copyReader(Reader source, Writer dest, int bufferSize, long streamSize, CopyStreamListener listener) throws CopyStreamException(Code) | | Copies the contents of a Reader to a Writer using a
copy buffer of a given size and notifies the provided
CopyStreamListener of the progress of the copy operation by calling
its bytesTransferred(long, int) method after each write to the
destination. If you wish to notify more than one listener you should
use a CopyStreamAdapter as the listener and register the additional
listeners with the CopyStreamAdapter.
The contents of the Reader are
read until its end is reached, but neither the source nor the
destination are closed. You must do this yourself outside of the
method call. The number of characters read/written is returned.
Parameters: source - The source Reader. Parameters: dest - The destination writer. Parameters: bufferSize - The number of characters to buffer during the copy. Parameters: streamSize - The number of characters in the stream being copied.Should be set to CopyStreamEvent.UNKNOWN_STREAM_SIZE if unknown. Parameters: listener - The CopyStreamListener to notify of progress. Ifthis parameter is null, notification is not attempted. The number of characters read/written in the copy operation. exception: CopyStreamException - If an error occurs while reading from thesource or writing to the destination. The CopyStreamExceptionwill contain the number of bytes confirmed to have beentransferred before anIOException occurred, and it will also contain the IOExceptionthat caused the error. These values can be retrieved withthe CopyStreamException getTotalBytesTransferred() andgetIOException() methods. |
copyReader | final public static long copyReader(Reader source, Writer dest, int bufferSize) throws CopyStreamException(Code) | | Copies the contents of a Reader to a Writer using a
copy buffer of a given size. The contents of the Reader are
read until its end is reached, but neither the source nor the
destination are closed. You must do this yourself outside of the
method call. The number of characters read/written is returned.
Parameters: source - The source Reader. Parameters: dest - The destination writer. Parameters: bufferSize - The number of characters to buffer during the copy. The number of characters read/written in the copy operation. exception: CopyStreamException - If an error occurs while reading from thesource or writing to the destination. The CopyStreamExceptionwill contain the number of bytes confirmed to have beentransferred before anIOException occurred, and it will also contain the IOExceptionthat caused the error. These values can be retrieved withthe CopyStreamException getTotalBytesTransferred() andgetIOException() methods. |
copyStream | final public static long copyStream(InputStream source, OutputStream dest, int bufferSize, long streamSize, CopyStreamListener listener, boolean flush) throws CopyStreamException(Code) | | Copies the contents of an InputStream to an OutputStream using a
copy buffer of a given size and notifies the provided
CopyStreamListener of the progress of the copy operation by calling
its bytesTransferred(long, int) method after each write to the
destination. If you wish to notify more than one listener you should
use a CopyStreamAdapter as the listener and register the additional
listeners with the CopyStreamAdapter.
The contents of the InputStream are
read until the end of the stream is reached, but neither the
source nor the destination are closed. You must do this yourself
outside of the method call. The number of bytes read/written is
returned.
Parameters: source - The source InputStream. Parameters: dest - The destination OutputStream. Parameters: bufferSize - The number of bytes to buffer during the copy. Parameters: streamSize - The number of bytes in the stream being copied.Should be set to CopyStreamEvent.UNKNOWN_STREAM_SIZE if unknown. Parameters: listener - The CopyStreamListener to notify of progress. Ifthis parameter is null, notification is not attempted. Parameters: flush - Whether to flush the output stream after everywrite. This is necessary for interactive sessions that rely onbuffered streams. If you don't flush, the data will stay inthe stream buffer. exception: CopyStreamException - If an error occurs while reading from thesource or writing to the destination. The CopyStreamExceptionwill contain the number of bytes confirmed to have beentransferred before anIOException occurred, and it will also contain the IOExceptionthat caused the error. These values can be retrieved withthe CopyStreamException getTotalBytesTransferred() andgetIOException() methods. |
copyStream | final public static long copyStream(InputStream source, OutputStream dest, int bufferSize, long streamSize, CopyStreamListener listener) throws CopyStreamException(Code) | | Copies the contents of an InputStream to an OutputStream using a
copy buffer of a given size and notifies the provided
CopyStreamListener of the progress of the copy operation by calling
its bytesTransferred(long, int) method after each write to the
destination. If you wish to notify more than one listener you should
use a CopyStreamAdapter as the listener and register the additional
listeners with the CopyStreamAdapter.
The contents of the InputStream are
read until the end of the stream is reached, but neither the
source nor the destination are closed. You must do this yourself
outside of the method call. The number of bytes read/written is
returned.
Parameters: source - The source InputStream. Parameters: dest - The destination OutputStream. Parameters: bufferSize - The number of bytes to buffer during the copy. Parameters: streamSize - The number of bytes in the stream being copied.Should be set to CopyStreamEvent.UNKNOWN_STREAM_SIZE if unknown. Parameters: listener - The CopyStreamListener to notify of progress. Ifthis parameter is null, notification is not attempted. exception: CopyStreamException - If an error occurs while reading from thesource or writing to the destination. The CopyStreamExceptionwill contain the number of bytes confirmed to have beentransferred before anIOException occurred, and it will also contain the IOExceptionthat caused the error. These values can be retrieved withthe CopyStreamException getTotalBytesTransferred() andgetIOException() methods. |
copyStream | final public static long copyStream(InputStream source, OutputStream dest, int bufferSize) throws CopyStreamException(Code) | | Copies the contents of an InputStream to an OutputStream using a
copy buffer of a given size. The contents of the InputStream are
read until the end of the stream is reached, but neither the
source nor the destination are closed. You must do this yourself
outside of the method call. The number of bytes read/written is
returned.
Parameters: source - The source InputStream. Parameters: dest - The destination OutputStream. The number of bytes read/written in the copy operation. exception: CopyStreamException - If an error occurs while reading from thesource or writing to the destination. The CopyStreamExceptionwill contain the number of bytes confirmed to have beentransferred before anIOException occurred, and it will also contain the IOExceptionthat caused the error. These values can be retrieved withthe CopyStreamException getTotalBytesTransferred() andgetIOException() methods. |
|
|