public abstract class BufferedIndexInput extends IndexInput
IndexInput
.Modifier and Type | Field and Description |
---|---|
protected byte[] |
buffer |
static int |
BUFFER_SIZE
Default buffer size
|
Constructor and Description |
---|
BufferedIndexInput() |
BufferedIndexInput(int bufferSize)
Inits BufferedIndexInput with a specific bufferSize
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Returns a clone of this stream.
|
int |
getBufferSize()
Returns buffer size.
|
long |
getFilePointer()
Returns the current position in this file, where the next read will
occur.
|
protected void |
newBuffer(byte[] newBuffer) |
byte |
readByte()
Reads and returns a single byte.
|
void |
readBytes(byte[] b,
int offset,
int len)
Reads a specified number of bytes into an array at the specified offset.
|
void |
readBytes(byte[] b,
int offset,
int len,
boolean useBuffer)
Reads a specified number of bytes into an array at the
specified offset with control over whether the read
should be buffered (callers who have their own buffer
should pass in "false" for useBuffer).
|
protected abstract void |
readInternal(byte[] b,
int offset,
int length)
Expert: implements buffer refill.
|
void |
seek(long pos)
Sets current position in this file, where the next read will occur.
|
protected abstract void |
seekInternal(long pos)
Expert: implements seek.
|
void |
setBufferSize(int newSize)
Change the buffer size used by this IndexInput
|
close, length, readChars, readInt, readLong, readString, readStringStringMap, readVInt, readVLong, setModifiedUTF8StringsMode, skipChars
public static final int BUFFER_SIZE
protected byte[] buffer
public BufferedIndexInput()
public BufferedIndexInput(int bufferSize)
public byte readByte() throws java.io.IOException
IndexInput
readByte
in class IndexInput
java.io.IOException
IndexOutput.writeByte(byte)
public void setBufferSize(int newSize)
protected void newBuffer(byte[] newBuffer)
public int getBufferSize()
public void readBytes(byte[] b, int offset, int len) throws java.io.IOException
IndexInput
readBytes
in class IndexInput
b
- the array to read bytes intooffset
- the offset in the array to start storing byteslen
- the number of bytes to readjava.io.IOException
IndexOutput.writeBytes(byte[],int)
public void readBytes(byte[] b, int offset, int len, boolean useBuffer) throws java.io.IOException
IndexInput
BufferedIndexInput
respects this parameter.readBytes
in class IndexInput
b
- the array to read bytes intooffset
- the offset in the array to start storing byteslen
- the number of bytes to readuseBuffer
- set to false if the caller will handle
buffering.java.io.IOException
IndexOutput.writeBytes(byte[],int)
protected abstract void readInternal(byte[] b, int offset, int length) throws java.io.IOException
b
- the array to read bytes intooffset
- the offset in the array to start storing byteslength
- the number of bytes to readjava.io.IOException
public long getFilePointer()
IndexInput
getFilePointer
in class IndexInput
IndexInput.seek(long)
public void seek(long pos) throws java.io.IOException
IndexInput
seek
in class IndexInput
java.io.IOException
IndexInput.getFilePointer()
protected abstract void seekInternal(long pos) throws java.io.IOException
readInternal(byte[],int,int)
will occur.java.io.IOException
readInternal(byte[],int,int)
public java.lang.Object clone()
IndexInput
Clones of a stream access the same data, and are positioned at the same point as the stream they were cloned from.
Expert: Subclasses must ensure that clones may be positioned at different points in the input from each other and from the stream they were cloned from.
clone
in class IndexInput
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.