Class RawInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.cassandra.analytics.reader.common.RawInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class RawInputStream extends java.io.InputStream
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]bufferprotected longbufferOffsetprotected longcurrentprotected java.io.DataInputStreamsourceprotected org.apache.cassandra.analytics.stats.Statsstatsprotected intvalidBufferBytes
-
Constructor Summary
Constructors Constructor Description RawInputStream(java.io.DataInputStream source, byte[] buffer, org.apache.cassandra.analytics.stats.Stats stats)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected booleanfinishedReadingBuffer()booleanisEOF()protected voidmaybeReBuffer()protected longmaybeStandardSkip(long count)Perform standard in-memory skip if n is less than or equal to the number of bytes buffered in memorylongposition()`current` tracks the current position in the source, this isn't necessarily total bytes read as skipping at the base InputStream might seek to the new offset without reading the bytesintread()intread(byte[] buff, int offset, int length)protected voidreBuffer()protected intremainingBytes()longskip(long count)protected longskipBuffered()Skip any bytes already buffered in the 'buffer' arraylongstandardSkip(long count)
-
-
-
Method Detail
-
isEOF
public boolean isEOF()
-
finishedReadingBuffer
protected boolean finishedReadingBuffer()
-
maybeReBuffer
protected void maybeReBuffer() throws java.io.IOException- Throws:
java.io.IOException
-
reBuffer
protected void reBuffer() throws java.io.IOException- Throws:
java.io.IOException
-
position
public long position()
`current` tracks the current position in the source, this isn't necessarily total bytes read as skipping at the base InputStream might seek to the new offset without reading the bytes- Returns:
- the current position in the source
-
maybeStandardSkip
protected long maybeStandardSkip(long count) throws java.io.IOExceptionPerform standard in-memory skip if n is less than or equal to the number of bytes buffered in memory- Parameters:
count- the number of bytes to be skipped- Returns:
- number of bytes skipped or -1 if not skipped
- Throws:
java.io.IOException- IOException
-
skipBuffered
protected long skipBuffered() throws java.io.IOExceptionSkip any bytes already buffered in the 'buffer' array- Returns:
- bytes actually skipped
- Throws:
java.io.IOException- IOException
-
standardSkip
public long standardSkip(long count) throws java.io.IOException- Throws:
java.io.IOException
-
skip
public long skip(long count) throws java.io.IOException- Overrides:
skipin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(@NotNull byte[] buff, int offset, int length) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
remainingBytes
protected int remainingBytes()
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException
-
-