E
- the type of the local target
for I/O operations.@NotThreadSafe public abstract class OutputSocket<E extends Entry> extends IOSocket<E,Entry>
Note that the entity relationship between output sockets and input sockets is n:1, i.e. any output socket can have at most one peer input socket, but it may be the peer of many other input sockets.
InputSocket
Constructor and Description |
---|
OutputSocket() |
Modifier and Type | Method and Description |
---|---|
OutputSocket<E> |
bind(OutputSocket<?> to)
Binds this socket to given socket by inheriting its
peer target . |
Entry |
getPeerTarget()
Returns the peer target for I/O operations.
|
abstract OutputStream |
newOutputStream()
Returns a new output stream for writing bytes to the
local target . |
SeekableByteChannel |
newSeekableByteChannel()
Optional: Returns a new seekable byte channel for writing bytes
to the
local target in arbitrary order. |
public final OutputSocket<E> bind(OutputSocket<?> to)
peer target
.
Note that this method does not change the state of the
given socket and does not connect this socket to the peer
socket, that is it does not set this socket as the peer of of the given
socket.to
- the output socket with the peer target to inherit.this
IllegalArgumentException
- if this
== to
.@Nullable public final Entry getPeerTarget() throws IOException
The same considerations as for IOSocket.getLocalTarget()
apply here, too.
The peer target is null
if and only if this socket is not
connect(de.schlichtherle.truezip.socket.InputSocket<?>)
ed to another socket.
getPeerTarget
in class IOSocket<E extends Entry,Entry>
IOException
- On any I/O failure.@CreatesObligation public abstract OutputStream newOutputStream() throws IOException
local target
.
Implementations must enable calling this method any number of times.
Furthermore, the returned output stream should not be buffered.
Buffering should be addressed by the caller instead - see
IOSocket.copy(de.schlichtherle.truezip.socket.InputSocket<?>, de.schlichtherle.truezip.socket.OutputSocket<?>)
.
IOException
- On any I/O failure.@CreatesObligation public SeekableByteChannel newSeekableByteChannel() throws IOException
local target
in arbitrary order.
If this method is supported, implementations must enable calling it any number of times. Furthermore, the returned seekable byte channel should not be buffered. Buffering should be addressed by client applications instead.
IOException
- On any I/O failure.UnsupportedOperationException
- if this operation is not supported
by the implementation.Copyright © 2005–2018 Schlichtherle IT Services. All rights reserved.