java.lang.Object
org.xbib.rpm.io.ChannelWrapper
org.xbib.rpm.io.ReadableChannelWrapper
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,ReadableByteChannel
Wrapper for observing data read from a NIO channel. This wrapper is
used for operations that must be notified of incoming IO data.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.xbib.rpm.io.ChannelWrapper
ChannelWrapper.Consumer<T>, ChannelWrapper.Key<T> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the underlying read channel and complete any operations in the consumer.booleanisOpen()Boolean flag indicating whether the channel is open or closed.intread(ByteBuffer buffer) Reads data from the channel and passes it to the consumer.Methods inherited from class org.xbib.rpm.io.ChannelWrapper
empty, fill, fill, finish, startCount, startCount
-
Field Details
-
channel
-
-
Constructor Details
-
ReadableChannelWrapper
-
-
Method Details
-
read
Reads data from the channel and passes it to the consumer. This method does not mutate the acutal data in the provided buffer, but makes it's own copy to pass to the consumer.- Specified by:
readin interfaceReadableByteChannel- Parameters:
buffer- the buffer to read into- Returns:
- the number of bytes read from the underlying channel
- Throws:
IOException- if an IO error occurrs
-
close
Close the underlying read channel and complete any operations in the consumer.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Overrides:
closein classChannelWrapper- Throws:
IOException- if an IO error occurrs
-
isOpen
public boolean isOpen()Boolean flag indicating whether the channel is open or closed.
-