Class BufferedIndexInput

All Implemented Interfaces:
Closeable, AutoCloseable, Cloneable, RandomAccessInput
Direct Known Subclasses:
BufferedIndexInput.SlicedIndexInput, NIOFSDirectory.NIOFSIndexInput, RAFDirectory.RAFIndexInput

public abstract class BufferedIndexInput extends IndexInput implements RandomAccessInput
Base implementation class for buffered IndexInput.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static final class 
    Implementation of an IndexInput that reads from a portion of a file.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private ByteBuffer
     
    static final int
    Default buffer size set to 1024.
    private final int
     
    private long
     
    private static final ByteBuffer
     
    static final int
    A buffer size for merges set to 4096.
    static final int
    Minimum buffer size allowed
  • Constructor Summary

    Constructors
    Constructor
    Description
    BufferedIndexInput(String resourceDesc)
     
    BufferedIndexInput(String resourceDesc, int bufferSize)
    Inits BufferedIndexInput with a specific bufferSize
    BufferedIndexInput(String resourceDesc, IOContext context)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    Returns default buffer sizes for the given IOContext
    private void
    checkBufferSize(int bufferSize)
     
    Returns a clone of this stream.
    final int
    Returns buffer size
    final long
    Returns the current position in this file, where the next read will occur.
    final byte
    Reads and returns a single byte.
    final byte
    readByte(long pos)
    Reads a byte at the given position in the file
    final void
    readBytes(byte[] b, int offset, int len)
    Reads a specified number of bytes into an array at the specified offset.
    final 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
    readFloats(float[] dst, int offset, int len)
    Reads a specified number of floats into an array at the specified offset.
    protected void
    readGroupVInt(long[] dst, int offset)
    Override if you have a efficient implementation.
    final int
    Reads four bytes and returns an int (LE byte order).
    final int
    readInt(long pos)
    Reads an integer (LE byte order) at the given position in the file
    protected abstract void
    Expert: implements buffer refill.
    void
    readInts(int[] dst, int offset, int len)
    Reads a specified number of ints into an array at the specified offset.
    final long
    Reads eight bytes and returns a long (LE byte order).
    final long
    readLong(long pos)
    Reads a long (LE byte order) at the given position in the file
    void
    readLongs(long[] dst, int offset, int len)
    Read a specified number of longs.
    final short
    Reads two bytes and returns a short (LE byte order).
    final short
    readShort(long pos)
    Reads a short (LE byte order) at the given position in the file
    final int
    Reads an int stored in variable-length format.
    final long
    Reads a long stored in variable-length format.
    private void
     
    private long
    resolvePositionInBuffer(long pos, int width)
     
    final 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.
    slice(String sliceDescription, long offset, long length)
    Creates a slice of this index input, with the given description, offset, and length.
    wrap(String sliceDescription, IndexInput other, long offset, long length)
    Wraps a portion of another IndexInput with buffering.

    Methods inherited from class org.apache.lucene.store.IndexInput

    close, getFullSliceDescription, length, randomAccessSlice, skipBytes, toString

    Methods inherited from class org.apache.lucene.store.DataInput

    readGroupVInts, readMapOfStrings, readSetOfStrings, readString, readZInt, readZLong

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.lucene.store.RandomAccessInput

    length