Package org.apache.solr.common.util
Class FastInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.solr.common.util.DataInputInputStream
-
- org.apache.solr.common.util.FastInputStream
-
- All Implemented Interfaces:
Closeable,DataInput,AutoCloseable
public class FastInputStream extends DataInputInputStream
Single threaded buffered InputStream Internal Solr use only, subject to change.
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]bufprotected intendprotected InputStreaminprotected intposprotected longreadFromStream
-
Constructor Summary
Constructors Constructor Description FastInputStream(InputStream in)FastInputStream(InputStream in, byte[] tempBuffer, int start, int end)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()byte[]getBuffer()Returns the internal buffer used for cachingintgetEndInBuffer()Current end-of-data position within the internal buffer.intgetPositionInBuffer()Current position within the internal bufferintpeek()longposition()intread()intread(byte[] b, int off, int len)booleanreadBoolean()bytereadByte()charreadChar()doublereadDouble()floatreadFloat()voidreadFully(byte[] b)voidreadFully(byte[] b, int off, int len)intreadInt()StringreadLine()longreadLong()shortreadShort()intreadUnsignedByte()intreadUnsignedShort()StringreadUTF()intreadWrappedStream(byte[] target, int offset, int len)voidrefill()intskipBytes(int n)static FastInputStreamwrap(InputStream in)-
Methods inherited from class org.apache.solr.common.util.DataInputInputStream
readDirectByteBuffer
-
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Field Detail
-
in
protected final InputStream in
-
buf
protected final byte[] buf
-
pos
protected int pos
-
end
protected int end
-
readFromStream
protected long readFromStream
-
-
Constructor Detail
-
FastInputStream
public FastInputStream(InputStream in)
-
FastInputStream
public FastInputStream(InputStream in, byte[] tempBuffer, int start, int end)
-
-
Method Detail
-
wrap
public static FastInputStream wrap(InputStream in)
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
peek
public int peek() throws IOException- Throws:
IOException
-
readUnsignedByte
public int readUnsignedByte() throws IOException- Throws:
IOException
-
readWrappedStream
public int readWrappedStream(byte[] target, int offset, int len) throws IOException- Throws:
IOException
-
position
public long position()
-
refill
public void refill() throws IOException- Throws:
IOException
-
available
public int available() throws IOException- Overrides:
availablein classInputStream- Throws:
IOException
-
getBuffer
public byte[] getBuffer()
Returns the internal buffer used for caching
-
getPositionInBuffer
public int getPositionInBuffer()
Current position within the internal buffer
-
getEndInBuffer
public int getEndInBuffer()
Current end-of-data position within the internal buffer. This is one past the last valid byte.
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
readFully
public void readFully(byte[] b) throws IOException- Throws:
IOException
-
readFully
public void readFully(byte[] b, int off, int len) throws IOException- Throws:
IOException
-
skipBytes
public int skipBytes(int n) throws IOException- Throws:
IOException
-
readBoolean
public boolean readBoolean() throws IOException- Throws:
IOException
-
readByte
public byte readByte() throws IOException- Throws:
IOException
-
readShort
public short readShort() throws IOException- Throws:
IOException
-
readUnsignedShort
public int readUnsignedShort() throws IOException- Throws:
IOException
-
readChar
public char readChar() throws IOException- Throws:
IOException
-
readInt
public int readInt() throws IOException- Throws:
IOException
-
readLong
public long readLong() throws IOException- Throws:
IOException
-
readFloat
public float readFloat() throws IOException- Throws:
IOException
-
readDouble
public double readDouble() throws IOException- Throws:
IOException
-
readLine
public String readLine() throws IOException
- Throws:
IOException
-
readUTF
public String readUTF() throws IOException
- Throws:
IOException
-
-