public interface Output extends Closeable
CryptoOutputStream
so that different implementation of output
can be used. The implementation Output interface will usually wraps an output
mechanism such as OutputStream
or
WritableByteChannel
.Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this output and releases any system resources associated with the
under layer output.
|
void |
flush()
Flushes this output and forces any buffered output bytes to be written
out if the under layer output method support.
|
int |
write(ByteBuffer src)
Writes a sequence of bytes to this output from the given buffer.
|
void close() throws IOException
close
in interface AutoCloseable
close
in interface Closeable
IOException
- if an I/O error occurs.void flush() throws IOException
flush
is that calling it is an indication that, if any bytes
previously written have been buffered by the implementation of the output
stream, such bytes should immediately be written to their intended
destination.IOException
- if an I/O error occurs.int write(ByteBuffer src) throws IOException
An attempt is made to write up to r bytes to the channel, where
r is the number of bytes remaining in the buffer, that is,
src.remaining()
, at the moment this method is invoked.
Suppose that a byte sequence of length n is written, where
0
<=
n <=
r. This byte sequence will be transferred from the buffer
starting at index p, where p is the buffer's position at
the moment this method is invoked; the index of the last byte written
will be p +
n -
1
. Upon return the buffer's position will be equal to
p +
n; its limit will not have changed.
src
- The buffer from which bytes are to be retrieved.IOException
- If some other I/O error occurs.Copyright © 2016–2022 The Apache Software Foundation. All rights reserved.