Package org.aksw.commons.io.hadoop
Class SeekableInputStreams
java.lang.Object
org.aksw.commons.io.hadoop.SeekableInputStreams
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interface -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadvertiseEndOfBlock(InputStream decodedIn) The argument for invoking this methods must be a seekable input streams that implements hadoop's protocol for splittable codecs using READ_MODE.BYBLOCK.advertiseEndOfBlock(InputStream decodedIn, int endOfBlockMarker) static <T extends ReadableByteChannel>
SeekableInputStreamcreate(InputStream in, GetPosition getPosition, SetPosition setPosition) static SeekableInputStreamcreate(InputStream in, org.apache.hadoop.fs.Seekable seekable) static <T extends ReadableByteChannel>
SeekableInputStreamcreate(SeekableByteChannel channel) static <T extends ReadableByteChannel>
SeekableInputStreamcreate(SeekableReadableChannel<byte[]> channel) static <T extends ReadableByteChannel>
SeekableInputStreamcreate(T channel, SeekableInputStreams.GetPositionFn<? super T> getPosition, SeekableInputStreams.SetPositionFn<? super T> setPosition) static org.apache.hadoop.fs.SeekablecreateSeekable(GetPosition getPosition, SetPosition setPosition) static SeekableReadableChannel<byte[]>Bridge SeekableInputStream to the channel API
-
Constructor Details
-
SeekableInputStreams
public SeekableInputStreams()
-
-
Method Details
-
createSeekable
public static org.apache.hadoop.fs.Seekable createSeekable(GetPosition getPosition, SetPosition setPosition) -
create
public static <T extends ReadableByteChannel> SeekableInputStream create(T channel, SeekableInputStreams.GetPositionFn<? super T> getPosition, SeekableInputStreams.SetPositionFn<? super T> setPosition) -
wrap
Bridge SeekableInputStream to the channel API -
create
public static <T extends ReadableByteChannel> SeekableInputStream create(SeekableByteChannel channel) -
create
public static <T extends ReadableByteChannel> SeekableInputStream create(SeekableReadableChannel<byte[]> channel) -
create
public static <T extends ReadableByteChannel> SeekableInputStream create(InputStream in, GetPosition getPosition, SetPosition setPosition) -
create
-
advertiseEndOfBlock
public static ReadableChannelWithBlockAdvertisement advertiseEndOfBlock(InputStream decodedIn) throws IOException The argument for invoking this methods must be a seekable input streams that implements hadoop's protocol for splittable codecs using READ_MODE.BYBLOCK. Whereas hadoop's protocol will always read 1 byte beyond the split boundary, this wrapper will stop exactly at that boundary. Internally a push-back input stream is used to push that single "read-ahead" byte back once it is encountered. A block boundary is advertised by a call to read() by returing -2. This return value indicates that read() may be called again and will return at least one more byte. A return value of -1 indicates "end of file" just as usual.- Parameters:
decodedIn-endOfBlockMarker- The value to return when an end of block is detected- Returns:
- Throws:
IOException
-
advertiseEndOfBlock
public static ReadableChannelWithBlockAdvertisement advertiseEndOfBlock(InputStream decodedIn, int endOfBlockMarker) throws IOException - Throws:
IOException
-