@ComponentSpecification public interface StreamUtil
InputStreams,
OutputStreams, Readers and Writers. StreamUtilImpl| Modifier and Type | Method and Description |
|---|---|
void |
close(Channel channel)
This method closes the given
channel without throwing an Exception. |
void |
close(InputStream inputStream)
This method closes the given
inputStream without throwing an Exception. |
void |
close(OutputStream outputStream)
This method closes the given
outputStream without throwing an IOException. |
void |
close(Reader reader)
This method closes the given
reader without throwing an Exception. |
void |
close(Writer writer)
This method closes the given
writer without throwing an IOException. |
Properties |
loadProperties(InputStream inStream)
|
Properties |
loadProperties(Reader reader)
|
String |
read(Reader reader)
This method reads the contents of the given
reader into a string. |
PrintWriter |
toPrintWriter(Appendable appendable)
This method converts the given
Appendable to a PrintWriter. |
Writer |
toWriter(Appendable appendable)
This method converts the given
Appendable to a Writer. |
long |
transfer(FileInputStream inStream,
OutputStream outStream,
boolean keepOutStreamOpen)
|
long |
transfer(InputStream inStream,
FileOutputStream outStream,
boolean keepOutStreamOpen,
long size)
|
long |
transfer(InputStream inStream,
OutputStream outStream,
boolean keepOutStreamOpen)
This method transfers the contents of the given
inStream to the given outStream . |
long |
transfer(Reader reader,
Writer writer,
boolean keepWriterOpen)
This method transfers the contents of the given
reader to the given writer. |
AsyncTransferrer |
transferAsync(InputStream inStream,
OutputStream outStream,
boolean keepOutStreamOpen)
This method transfers the contents of the given
inStream to the given outStream . |
AsyncTransferrer |
transferAsync(InputStream inStream,
OutputStream outStream,
boolean keepOutStreamOpen,
TransferCallback callback)
This method transfers the contents of the given
inStream to the given outStream . |
AsyncTransferrer |
transferAsync(Reader reader,
Writer writer,
boolean keepWriterOpen)
This method transfers the contents of the given
reader to the given writer. |
AsyncTransferrer |
transferAsync(Reader reader,
Writer writer,
boolean keepWriterOpen,
TransferCallback callback)
This method transfers the contents of the given
reader to the given writer. |
String read(Reader reader) throws RuntimeIoException
reader into a string. reader is read into memory.reader - is where to read the content from. It will be closed at the end.reader.RuntimeIoException - if an error occurred with an I/O error.long transfer(Reader reader, Writer writer, boolean keepWriterOpen) throws RuntimeIoException
reader to the given writer.reader - is where to read the content from. Will be closed at the end.writer - is where to write the content to. Will be closed at the end if
keepWriterOpen is false.keepWriterOpen - if true the given writer will remain open so that additional
content can be appended. Else if false, the writer will be closed.RuntimeIoException - if the operation failed. Closing is guaranteed even in exception state.long transfer(FileInputStream inStream, OutputStream outStream, boolean keepOutStreamOpen) throws RuntimeIoException
inStream - is where to read the content from. Will be closed at the end.outStream - is where to write the content to. Will be closed at the end
if keepOutStreamOpen is false.keepOutStreamOpen - if true the given outStream will remain open so that additional
content can be appended. Else if false, the outStream will be
closed.RuntimeIoException - if the operation failed. Closing is guaranteed even in exception state.long transfer(InputStream inStream, FileOutputStream outStream, boolean keepOutStreamOpen, long size) throws RuntimeIoException
inStream - is where to read the content from. Will be closed at the end.outStream - is where to write the content to. Will be closed at the end
if keepOutStreamOpen is false.keepOutStreamOpen - if true the given outStream will remain open so that additional
content can be appended. Else if false, the outStream will be
closed.size - is the number of bytes to transfer.RuntimeIoException - if the operation failed. Closing is guaranteed even in exception state.long transfer(InputStream inStream, OutputStream outStream, boolean keepOutStreamOpen) throws RuntimeIoException
inStream to the given outStream .inStream - is where to read the content from. Will be closed at the end.outStream - is where to write the content to. Will be closed at the end
if keepOutStreamOpen is false.keepOutStreamOpen - if true the given outStream will remain open so that additional
content can be appended. Else if false, the outStream will be
closed.RuntimeIoException - if the operation failed. Closing is guaranteed even in exception state.AsyncTransferrer transferAsync(InputStream inStream, OutputStream outStream, boolean keepOutStreamOpen)
inStream to the given outStream .inStream - is where to read the content from. Will be closed at the end.outStream - is where to write the content to. Will be closed at the end
if keepOutStreamOpen is false.keepOutStreamOpen - if true the given outStream will remain open so that additional
content can be appended. Else if false, the outStream will be
closed.AsyncTransferrer transferAsync(InputStream inStream, OutputStream outStream, boolean keepOutStreamOpen, TransferCallback callback)
inStream to the given outStream .inStream - is where to read the content from. Will be closed at the end.outStream - is where to write the content to. Will be closed at the end
if keepOutStreamOpen is false.keepOutStreamOpen - if true the given outStream will remain open so that additional
content can be appended. Else if false, the outStream will be
closed.callback - is the callback that is invoked if the transfer is done.AsyncTransferrer transferAsync(Reader reader, Writer writer, boolean keepWriterOpen)
reader to the given writer.reader - is where to read the content from. Will be closed at the end.writer - is where to write the content to. Will be closed at the end if
keepWriterOpen is false.keepWriterOpen - if true the given writer will remain open so that additional
content can be appended. Else if false, the writer will be closed.AsyncTransferrer transferAsync(Reader reader, Writer writer, boolean keepWriterOpen, TransferCallback callback)
reader to the given writer.reader - is where to read the content from. Will be closed at the end.writer - is where to write the content to. Will be closed at the end if
keepWriterOpen is false.keepWriterOpen - if true the given writer will remain open so that additional
content can be appended. Else if false, the writer will be closed.callback - is the callback that is invoked if the transfer is done.Properties loadProperties(InputStream inStream) throws RuntimeIoException
Properties from the given inStream and closes it. ISO-8859-1 . Use
loadProperties(Reader) instead to use an explicit encoding (e.g. UTF-8).inStream - is the InputStream to the properties data.inStream.RuntimeIoException - if the operation failed. Closing is guaranteed even in exception state.Properties.load(InputStream)Properties loadProperties(Reader reader) throws RuntimeIoException
reader - is the Reader to the properties data.reader.RuntimeIoException - if the operation failed. Closing is guaranteed even in exception state.Properties.load(Reader)Writer toWriter(Appendable appendable)
Appendable to a Writer.appendable - is the Appendable to wrap.Writer.PrintWriter toPrintWriter(Appendable appendable)
Appendable to a PrintWriter.appendable - is the Appendable to wrap.PrintWriter.void close(InputStream inputStream)
inputStream without throwing an Exception. If an exception
occurs, it will only be logged.inputStream - is the input-stream to close.void close(OutputStream outputStream) throws RuntimeIoException
outputStream without throwing an IOException.outputStream - is the output-stream to close.RuntimeIoException - if the closing failed.void close(Writer writer) throws RuntimeIoException
writer without throwing an IOException.writer - is the writer to close.RuntimeIoException - if the closing failed.void close(Reader reader)
reader without throwing an Exception. If an exception
occurs, it will only be logged.reader - is the reader to close.Copyright © 2001–2016 mmm-Team. All rights reserved.