| java.lang.Object uk.org.ponder.streamutil.StreamCopyUtil
StreamCopyUtil | public class StreamCopyUtil (Code) | | This class contains static utility methods for operating on streams.
|
Field Summary | |
final public static int | PROCESS_BUFFER_SIZE A natural buffer size to be used where some significant processing is
applied to streams. |
Method Summary | |
public static InputStream | bottleToDisk(InputStream is, String filename) | final public static void | charWrapVectorToWriter(CharWrapVector source, Writer dest) Writes the contents of the supplied CharWrapVector to the specified writer,
closing the writer on completion or error. | final public static void | inputToOutput(InputStream source, OutputStream dest, byte[] buffer) Copies the supplied input stream to the specified output, closing both
streams on completion or error. | final public static void | inputToOutput(InputStream source, OutputStream dest, boolean closeinput, boolean closeoutput, byte[] buffer) Copies the supplied input stream to the specified output, allowing the user
to specify which of the streams are to be closed on completion or error. | final public static String | readerToString(Reader source) A useful utility method to fully read the data from the specified reader
and return it as a string.
Parameters: source - A reader containing the data to be read. | final public static StringList | readerToStringList(Reader source) Return \n-delimited data from a reader and return as a list of Strings. | final public static void | readerToWriter(Reader source, Writer dest) Copies the supplied reader to the specified writer, closing both streams on
completion or error. | public static String | streamToString(InputStream source) Produces a String representation of the complete contents of the supplied
string, assuming it to be encoded in UTF-8. |
PROCESS_BUFFER_SIZE | final public static int PROCESS_BUFFER_SIZE(Code) | | A natural buffer size to be used where some significant processing is
applied to streams.
|
charWrapVectorToWriter | final public static void charWrapVectorToWriter(CharWrapVector source, Writer dest) throws IOException(Code) | | Writes the contents of the supplied CharWrapVector to the specified writer,
closing the writer on completion or error.
Parameters: source - The CharWrapVector to be written Parameters: dest - The writer where the input data is to be copied. exception: IOException - if an I/O error occurs. |
inputToOutput | final public static void inputToOutput(InputStream source, OutputStream dest, byte[] buffer)(Code) | | Copies the supplied input stream to the specified output, closing both
streams on completion or error.
Parameters: source - The input stream to be copied. Parameters: dest - The output stream where the input data is to be copied. exception: IOException - if an I/O error occurs. |
inputToOutput | final public static void inputToOutput(InputStream source, OutputStream dest, boolean closeinput, boolean closeoutput, byte[] buffer)(Code) | | Copies the supplied input stream to the specified output, allowing the user
to specify which of the streams are to be closed on completion or error.
Parameters: source - The input stream to be copied. Parameters: dest - The output stream where the input data is to be copied. Parameters: closeinput - true if the input stream is to be closed oncompletion or error. Parameters: closeoutput - true if the output stream is to be closed oncompletion or error. exception: IOException - if an I/O error occurs. |
readerToString | final public static String readerToString(Reader source)(Code) | | A useful utility method to fully read the data from the specified reader
and return it as a string.
Parameters: source - A reader containing the data to be read. This stream will beclosed on completion or error. A string holding the complete contents read from the reader. exception: IOException - if an I/O error occurs. |
readerToStringList | final public static StringList readerToStringList(Reader source)(Code) | | Return \n-delimited data from a reader and return as a list of Strings.
The supplied reader WILL be closed!
|
readerToWriter | final public static void readerToWriter(Reader source, Writer dest) throws IOException(Code) | | Copies the supplied reader to the specified writer, closing both streams on
completion or error.
Parameters: source - The reader to be copied. Parameters: dest - The writer where the input data is to be copied. exception: IOException - if an I/O error occurs. |
streamToString | public static String streamToString(InputStream source)(Code) | | Produces a String representation of the complete contents of the supplied
string, assuming it to be encoded in UTF-8. The supplied stream WILL be
closed.
Parameters: source - |
|
|