Class NullChannel
java.lang.Object
org.apache.sis.internal.storage.io.NullChannel
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,ReadableByteChannel
A channel which read no values. This class behaves as if the channel already reached the end of file.
- Since:
- 1.3
- Version:
- 1.3
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this channel.booleanisOpen()Returns whether this channel is still open.intread(ByteBuffer dst) Pretends to read a sequence of bytes and indicates that the channel reached the end of file.
-
Field Details
-
closed
private volatile boolean closedWhether this channel has been closed.
-
-
Constructor Details
-
NullChannel
NullChannel()Creates an initially open channel.
-
-
Method Details
-
read
Pretends to read a sequence of bytes and indicates that the channel reached the end of file. Read-only buffers are accepted (this is required forChannelImageInputStream).- Specified by:
readin interfaceReadableByteChannel- Parameters:
dst- ignored except for non-null check.- Returns:
- always -1.
- Throws:
ClosedChannelException- if this channel has been closed.
-
isOpen
public boolean isOpen()Returns whether this channel is still open. -
close
public void close()Closes this channel. If this channel is already closed, then this method does nothing.
-