Class StreamOutput
java.lang.Object
org.apache.commons.crypto.stream.output.StreamOutput
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Output
The StreamOutput class takes a
OutputStream
object and wraps it
as Output
object acceptable by CryptoOutputStream
as the output target.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]
private final int
private final OutputStream
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Overrides theOutput.close()
.void
flush()
Overrides theOutput.flush()
.protected OutputStream
getOut()
Gets the output stream.int
write
(ByteBuffer src) Overrides theOutput.write(ByteBuffer)
.
-
Field Details
-
buf
private final byte[] buf -
bufferSize
private final int bufferSize -
out
-
-
Constructor Details
-
StreamOutput
Constructs a new instance.- Parameters:
out
- the OutputStream object.bufferSize
- the buffer size.
-
-
Method Details
-
close
Overrides theOutput.close()
. Closes this output and releases any system resources associated with the under layer output.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceOutput
- Throws:
IOException
- if an I/O error occurs.
-
flush
Overrides theOutput.flush()
. Flushes this output and forces any buffered output bytes to be written out if the under layer output method support.- Specified by:
flush
in interfaceOutput
- Throws:
IOException
- if an I/O error occurs.
-
getOut
Gets the output stream.- Returns:
- the output stream.
-
write
Overrides theOutput.write(ByteBuffer)
. Writes a sequence of bytes to this output from the given buffer.- Specified by:
write
in interfaceOutput
- Parameters:
src
- The buffer from which bytes are to be retrieved.- Returns:
- The number of bytes written, possibly zero.
- Throws:
IOException
- if an I/O error occurs.
-