Crossfire JXClient, Trunk
Public Member Functions | Private Attributes | List of all members
CustomAutoCloseableSample.TeeStream Class Reference
Inheritance diagram for CustomAutoCloseableSample.TeeStream:
Inheritance graph
Collaboration diagram for CustomAutoCloseableSample.TeeStream:
Collaboration graph

Public Member Functions

void close () throws IOException
 
void flush () throws IOException
 
 TeeStream (OutputStream outputStream, Path outputFile) throws IOException
 
void write (int b) throws IOException
 

Private Attributes

final OutputStream fileStream
 
final OutputStream outputStream
 

Detailed Description

Passes the output through to the specified output stream while copying it into a file. The TeeStream functionality is similar to the Unix tee utility. TeeStream implements AutoCloseable interface. See OutputStream for details.

Definition at line 78 of file CustomAutoCloseableSample.java.

Constructor & Destructor Documentation

◆ TeeStream()

CustomAutoCloseableSample.TeeStream.TeeStream ( OutputStream  outputStream,
Path  outputFile 
) throws IOException

Creates a TeeStream.

Parameters
outputStreaman output stream.
outputFilean path to file.
Exceptions
IOExceptionIf an I/O error occurs.

Definition at line 90 of file CustomAutoCloseableSample.java.

References CustomAutoCloseableSample.TeeStream.outputStream.

Member Function Documentation

◆ close()

void CustomAutoCloseableSample.TeeStream.close ( ) throws IOException

Closes underlying streams and resources. The external output stream won't be closed. This method is the member of AutoCloseable interface and it will be invoked automatically after the try-with-resources block.

Exceptions
IOExceptionIf an I/O error occurs.

Definition at line 131 of file CustomAutoCloseableSample.java.

References file, CustomAutoCloseableSample.TeeStream.fileStream, and CustomAutoCloseableSample.TeeStream.flush().

Here is the call graph for this function:

◆ flush()

void CustomAutoCloseableSample.TeeStream.flush ( ) throws IOException

Flushes this output stream and forces any buffered output bytes to be written out. The flush method of TeeStream flushes the specified output stream and the file output stream.

Exceptions
IOExceptionif an I/O error occurs.

Definition at line 117 of file CustomAutoCloseableSample.java.

References CustomAutoCloseableSample.TeeStream.fileStream, and CustomAutoCloseableSample.TeeStream.outputStream.

Referenced by CustomAutoCloseableSample.TeeStream.close().

Here is the caller graph for this function:

◆ write()

void CustomAutoCloseableSample.TeeStream.write ( int  b) throws IOException

Writes the specified byte to the specified output stream and copies it to the file.

Parameters
bthe byte to be written.
Exceptions
IOExceptionIf an I/O error occurs.

Definition at line 103 of file CustomAutoCloseableSample.java.

References CustomAutoCloseableSample.TeeStream.fileStream, and CustomAutoCloseableSample.TeeStream.outputStream.

Member Data Documentation

◆ fileStream

final OutputStream CustomAutoCloseableSample.TeeStream.fileStream
private

◆ outputStream

final OutputStream CustomAutoCloseableSample.TeeStream.outputStream
private

The documentation for this class was generated from the following file: