E - the type of the local target
for I/O operations.@NotThreadSafe @DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) 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| Modifier and Type | Field and Description |
|---|---|
private InputSocket<?> |
peer |
| Constructor and Description |
|---|
OutputSocket() |
| Modifier and Type | Method and Description |
|---|---|
OutputSocket<E> |
bind(OutputSocket<?> to)
Binds the peer target of the given socket to this socket.
|
(package private) OutputSocket<E> |
connect(InputSocket<?> newPeer)
Connects this output socket to the given peer input socket.
|
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. |
@CheckForNull private InputSocket<?> peer
@Nullable public 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>IOExceptionpublic final OutputSocket<E> bind(@CheckForNull OutputSocket<?> to)
to - the output socket which has a peer target to share.thisfinal OutputSocket<E> connect(@CheckForNull InputSocket<?> newPeer)
newPeer - the nullable peer input socket to connect to.thispublic 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<?>).
FileNotFoundException - if the local target is not accessible
for some reason.IOException - on any other exceptional condition.Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.