Package org.aksw.commons.io.util.channel
Class ReadableByteChannelFromInputStream
java.lang.Object
org.aksw.commons.io.util.channel.ReadableByteChannelFromInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,ReadableByteChannel
A replacement for Channels.newChannel with the following changes for
interoperability with hadoop and our GenericRecordReader:
- Does not close the underlying stream on interrupt
- This implementation's read method just delegates to the input stream
(without additional buffering / repeated reads).
This way hadoop's position advertising remains usable.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
in
-
buf
protected byte[] buf -
open
protected boolean open
-
-
Constructor Details
-
ReadableByteChannelFromInputStream
-
-
Method Details
-
read
- Specified by:
readin interfaceReadableByteChannel- Throws:
IOException
-
isOpen
public boolean isOpen() -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException
-