Class CustomBufferedIndexInput

java.lang.Object
org.apache.lucene.store.DataInput
org.apache.lucene.store.IndexInput
org.apache.solr.blockcache.CustomBufferedIndexInput
All Implemented Interfaces:
Closeable, AutoCloseable, Cloneable

public abstract class CustomBufferedIndexInput extends org.apache.lucene.store.IndexInput
WARNING: This API is experimental and might change in incompatible ways in the next release.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected byte[]
     
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    CustomBufferedIndexInput(String resourceDesc, int bufferSize)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.lucene.store.IndexInput
     
    final void
     
    protected abstract void
     
    protected int
    flushBuffer(org.apache.lucene.store.IndexOutput out, long numBytes)
    Flushes the in-memory bufer to the given output, copying at most numBytes.
    long
     
    byte
     
    void
    readBytes(byte[] b, int offset, int len)
     
    void
    readBytes(byte[] b, int offset, int len, boolean useBuffer)
     
    final int
     
    protected abstract void
    readInternal(byte[] b, int offset, int length)
    Expert: implements buffer refill.
    final long
     
    final short
     
    final int
     
    final long
     
    void
    seek(long pos)
     
    protected abstract void
    seekInternal(long pos)
    Expert: implements seek.
    org.apache.lucene.store.IndexInput
    slice(String sliceDescription, long offset, long length)
     

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

    getFullSliceDescription, isLoaded, length, prefetch, randomAccessSlice, skipBytes, slice, toString, updateIOContext

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

    readFloats, readGroupVInt, readInts, readLongs, readMapOfStrings, readSetOfStrings, readString, readZInt, readZLong

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • BUFFER_SIZE

      public static final int BUFFER_SIZE
    • buffer

      protected byte[] buffer
  • Constructor Details

    • CustomBufferedIndexInput

      public CustomBufferedIndexInput(String resourceDesc)
    • CustomBufferedIndexInput

      public CustomBufferedIndexInput(String resourceDesc, int bufferSize)
  • Method Details

    • readByte

      public byte readByte() throws IOException
      Specified by:
      readByte in class org.apache.lucene.store.DataInput
      Throws:
      IOException
    • readBytes

      public void readBytes(byte[] b, int offset, int len) throws IOException
      Specified by:
      readBytes in class org.apache.lucene.store.DataInput
      Throws:
      IOException
    • readBytes

      public void readBytes(byte[] b, int offset, int len, boolean useBuffer) throws IOException
      Overrides:
      readBytes in class org.apache.lucene.store.DataInput
      Throws:
      IOException
    • readShort

      public final short readShort() throws IOException
      Overrides:
      readShort in class org.apache.lucene.store.DataInput
      Throws:
      IOException
    • readInt

      public final int readInt() throws IOException
      Overrides:
      readInt in class org.apache.lucene.store.DataInput
      Throws:
      IOException
    • readLong

      public final long readLong() throws IOException
      Overrides:
      readLong in class org.apache.lucene.store.DataInput
      Throws:
      IOException
    • readVInt

      public final int readVInt() throws IOException
      Overrides:
      readVInt in class org.apache.lucene.store.DataInput
      Throws:
      IOException
    • readVLong

      public final long readVLong() throws IOException
      Overrides:
      readVLong in class org.apache.lucene.store.DataInput
      Throws:
      IOException
    • close

      public final void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in class org.apache.lucene.store.IndexInput
      Throws:
      IOException
    • closeInternal

      protected abstract void closeInternal() throws IOException
      Throws:
      IOException
    • readInternal

      protected abstract void readInternal(byte[] b, int offset, int length) throws IOException
      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
    • getFilePointer

      public long getFilePointer()
      Specified by:
      getFilePointer in class org.apache.lucene.store.IndexInput
    • seek

      public void seek(long pos) throws IOException
      Specified by:
      seek in class org.apache.lucene.store.IndexInput
      Throws:
      IOException
    • seekInternal

      protected abstract void seekInternal(long pos) throws IOException
      Expert: implements seek. Sets current position in this file, where the next readInternal(byte[],int,int) will occur.
      Throws:
      IOException
      See Also:
    • clone

      public org.apache.lucene.store.IndexInput clone()
      Overrides:
      clone in class org.apache.lucene.store.IndexInput
    • slice

      public org.apache.lucene.store.IndexInput slice(String sliceDescription, long offset, long length) throws IOException
      Specified by:
      slice in class org.apache.lucene.store.IndexInput
      Throws:
      IOException
    • flushBuffer

      protected int flushBuffer(org.apache.lucene.store.IndexOutput out, long numBytes) throws IOException
      Flushes the in-memory bufer to the given output, copying at most numBytes.

      NOTE: this method does not refill the buffer, however it does advance the buffer position.

      Returns:
      the number of bytes actually flushed from the in-memory buffer.
      Throws:
      IOException