E
- the type of the target entry for I/O
operations.@Immutable public abstract class DelegatingOutputSocket<E extends Entry> extends AbstractOutputSocket<E>
Implementations should be immutable.
DelegatingInputSocket
Constructor and Description |
---|
DelegatingOutputSocket() |
Modifier and Type | Method and Description |
---|---|
SeekableByteChannel |
channel(InputSocket<? extends Entry> peer)
Optional operation: Returns a new seekable byte channel for
writing bytes.
|
protected abstract OutputSocket<? extends E> |
socket()
Returns the delegate output socket.
|
OutputStream |
stream(InputSocket<? extends Entry> peer)
Returns a new output stream for writing bytes.
|
E |
target()
Resolves the target for I/O operations.
|
target
toString
equals, hashCode
public SeekableByteChannel channel(@CheckForNull InputSocket<? extends Entry> peer) throws IOException
AbstractOutputSocket
Because the intention of this interface is output, the returned channel
may not be able to position the file pointer or read data and any
attempt to do so may fail with a NonReadableChannelException
.
channel
in interface OutputSocket<E extends Entry>
channel
in class AbstractOutputSocket<E extends Entry>
peer
- the nullable peer socket for copying entry contents.IOException
- on any I/O error.protected abstract OutputSocket<? extends E> socket() throws IOException
IOException
- on any I/O error.public OutputStream stream(@CheckForNull InputSocket<? extends Entry> peer) throws IOException
AbstractOutputSocket
The implementation in the class OutputSocket
calls
AbstractOutputSocket.channel(net.java.truecommons.cio.InputSocket<? extends net.java.truecommons.cio.Entry>)
and wraps the result in a
ChannelOutputStream
adapter.
Note that this violates the contract for this method unless you
override either this method or AbstractOutputSocket.channel(net.java.truecommons.cio.InputSocket<? extends net.java.truecommons.cio.Entry>)
with a valid
implementation.
stream
in interface OutputSocket<E extends Entry>
stream
in class AbstractOutputSocket<E extends Entry>
peer
- the nullable peer socket for copying entry contents.IOException
- on any I/O error.public E target() throws IOException
IoSocket
Note that this interface contract does not state any other terms or conditions for the returned entry. In particular, the returned object may or may not be a defensive copy and it may or may not reflect the effect of subsequent I/O operations. So a client may only assume that the returned entry accurately reflects the state of its represented entity before the client does subsequent I/O. Implementations may add some constraints to ease the situation for clients.
IOException
- on any I/O error.Copyright © 2012–2015 Schlichtherle IT Services. All rights reserved.