Package org.aksw.commons.io.input
Class ReadableChannelWithSkipDelimiter<T extends ReadableChannel<byte[]>>
java.lang.Object
org.aksw.commons.util.closeable.AutoCloseableWrapperBase<T>
org.aksw.commons.io.shared.ChannelDecoratorBase<X>
org.aksw.commons.io.input.ReadableChannelDecoratorBase<byte[],T>
org.aksw.commons.io.input.ReadableChannelWithSkipDelimiter<T>
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,HasArrayOps<byte[]>,ReadableChannel<byte[]>,ReadableSource<byte[]>
public class ReadableChannelWithSkipDelimiter<T extends ReadableChannel<byte[]>>
extends ReadableChannelDecoratorBase<byte[],T>
Wrapper whose read method skips over the next byte delimiter (usually newline).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final byteprotected intprotected intprotected RingBufferForBytesFields inherited from class org.aksw.commons.util.closeable.AutoCloseableWrapperBase
delegate -
Constructor Summary
ConstructorsConstructorDescriptionReadableChannelWithSkipDelimiter(T delegate, byte delimiter, int initialSkipCount) -
Method Summary
Modifier and TypeMethodDescriptionintread(byte[] array, int position, int length) Read method following the usual InputStream protocol.Methods inherited from class org.aksw.commons.io.input.ReadableChannelDecoratorBase
getArrayOpsMethods inherited from class org.aksw.commons.io.shared.ChannelDecoratorBase
close, isOpenMethods inherited from class org.aksw.commons.util.closeable.AutoCloseableWrapperBase
close, getDelegateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.aksw.commons.io.input.ReadableSource
readRaw
-
Field Details
-
delimiter
protected final byte delimiter -
ringBuffer
-
initialSkipCount
protected int initialSkipCount -
remainingSkipCount
protected int remainingSkipCount
-
-
Constructor Details
-
ReadableChannelWithSkipDelimiter
-
-
Method Details
-
read
Description copied from interface:ReadableSourceRead method following the usual InputStream protocol.- Specified by:
readin interfaceReadableSource<T extends ReadableChannel<byte[]>>- Overrides:
readin classReadableChannelDecoratorBase<byte[],T extends ReadableChannel<byte[]>> - Parameters:
array- The array into which to put the read dataposition- Offset into array where to start writinglength- Maximum number of items to read.- Returns:
- The number of items read. Return -1 if end of data was reached, and 0 iff length was 0.
- Throws:
IOException
-