public abstract class

BufferedIndexInput

extends IndexInput
java.lang.Object
   ↳ org.apache.lucene.store.IndexInput
     ↳ org.apache.lucene.store.BufferedIndexInput
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Base implementation class for buffered IndexInput.

Summary

Constants
int BUFFER_SIZE Default buffer size
Fields
protected byte[] buffer
Public Constructors
BufferedIndexInput()
BufferedIndexInput(int bufferSize)
Inits BufferedIndexInput with a specific bufferSize
Public Methods
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.
byte readByte()
Reads and returns a single byte.
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).
void readBytes(byte[] b, int offset, int len)
Reads a specified number of bytes into an array at the specified offset.
void seek(long pos)
Sets current position in this file, where the next read will occur.
void setBufferSize(int newSize)
Change the buffer size used by this IndexInput
Protected Methods
void newBuffer(byte[] newBuffer)
abstract void readInternal(byte[] b, int offset, int length)
Expert: implements buffer refill.
abstract void seekInternal(long pos)
Expert: implements seek.
[Expand]
Inherited Methods
From class org.apache.lucene.store.IndexInput
From class java.lang.Object
From interface java.io.Closeable

Constants

public static final int BUFFER_SIZE

Default buffer size

Constant Value: 1024 (0x00000400)

Fields

protected byte[] buffer

Public Constructors

public BufferedIndexInput ()

public BufferedIndexInput (int bufferSize)

Inits BufferedIndexInput with a specific bufferSize

Public Methods

public Object clone ()

Returns a clone of this stream.

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.

public int getBufferSize ()

Returns buffer size. @see #setBufferSize

public long getFilePointer ()

Returns the current position in this file, where the next read will occur.

public byte readByte ()

Reads and returns a single byte.

Throws
IOException

public 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). Currently only BufferedIndexInput respects this parameter.

Parameters
b the array to read bytes into
offset the offset in the array to start storing bytes
len the number of bytes to read
useBuffer set to false if the caller will handle buffering.
Throws
IOException

public void readBytes (byte[] b, int offset, int len)

Reads a specified number of bytes into an array at the specified offset.

Parameters
b the array to read bytes into
offset the offset in the array to start storing bytes
len the number of bytes to read
Throws
IOException

public void seek (long pos)

Sets current position in this file, where the next read will occur.

Throws
IOException

public void setBufferSize (int newSize)

Change the buffer size used by this IndexInput

Protected Methods

protected void newBuffer (byte[] newBuffer)

protected abstract void readInternal (byte[] b, int offset, int length)

Expert: implements buffer refill. Reads bytes from the current position in the input.

Parameters
b the array to read bytes into
offset the offset in the array to start storing bytes
length the number of bytes to read
Throws
IOException

protected abstract void seekInternal (long pos)

Expert: implements seek. Sets current position in this file, where the next readInternal(byte[], int, int) will occur.

Throws
IOException