E
- the type of the target entry for I/O
operations.public interface IoSocket<E extends Entry>
An I/O socket is typically opaque, i.e. it encapsulates all parameters required for accessing the entry within its container without necessarily exposing these parameters to its clients.
An I/O socket is typically short lived because its created upon demand only in order to immediately create an I/O stream or channel and then gets discarded.
I/O sockets are designed to copy the contents of their targets fast and easily by using multithreading. When obtaining a stream or channel for copying entry contents, an I/O socket may use the provided peer I/O socket in order to negotiate how the entry contents shall get processed. For example, this may get used by an implementation in order to avoid redundant decompression and recompression when copying compressed entry contents from one container to another.
Implementations must ensure that an I/O socket is (at least virtually)
immutable, i.e. the parameters required for accessing the entry within its
container must not change.
In contrast, this does not apply to the entry or its container: Their state
should always be considered mutable - even for a read-only container.
This implies that it may change anytime, even concurrently!
At least, it's expected to change once some output has completed.
In order to reflect this, an implementation should not access the entry nor
the container and it should never throw an IOException
when creating
a I/O socket.
Implementations should be immutable.
Modifier and Type | Method and Description |
---|---|
E |
target()
Resolves the target for I/O operations.
|
E target() throws IOException
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.