E
- the type of the target entry for I/O
operations.@Immutable public abstract class DelegatingInputSocket<E extends Entry> extends AbstractInputSocket<E>
Implementations should be immutable.
DelegatingOutputSocket
Constructor and Description |
---|
DelegatingInputSocket() |
Modifier and Type | Method and Description |
---|---|
SeekableByteChannel |
channel(OutputSocket<? extends Entry> peer)
Optional operation: Returns a new seekable byte channel for
reading bytes.
|
protected abstract InputSocket<? extends E> |
socket()
Returns the delegate input socket.
|
InputStream |
stream(OutputSocket<? extends Entry> peer)
Returns a new input stream for reading bytes.
|
E |
target()
Resolves the target for I/O operations.
|
target
toString
equals, hashCode
public SeekableByteChannel channel(@CheckForNull OutputSocket<? extends Entry> peer) throws IOException
AbstractInputSocket
Because the intention of this interface is input, the returned channel
may not be able to write data and any attempt to do so should fail with
a NonWritableChannelException
.
channel
in interface InputSocket<E extends Entry>
channel
in class AbstractInputSocket<E extends Entry>
peer
- the nullable peer socket for copying entry contents.IOException
- on any I/O error.protected abstract InputSocket<? extends E> socket() throws IOException
IOException
- on any I/O error.public InputStream stream(@CheckForNull OutputSocket<? extends Entry> peer) throws IOException
AbstractInputSocket
The implementation in the class InputSocket
calls
AbstractInputSocket.channel(net.java.truecommons.cio.OutputSocket<? extends net.java.truecommons.cio.Entry>)
and wraps the result in a
ChannelInputStream
adapter.
Note that this violates the contract for this method unless you
override either this method or AbstractInputSocket.channel(net.java.truecommons.cio.OutputSocket<? extends net.java.truecommons.cio.Entry>)
with a valid
implementation.
stream
in interface InputSocket<E extends Entry>
stream
in class AbstractInputSocket<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–2014 Schlichtherle IT Services. All rights reserved.