org.apache.solr.store.blockcache
Class CustomBufferedIndexInput

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

public abstract class CustomBufferedIndexInput
extends IndexInput


Field Summary
protected  byte[] buffer
           
static int BUFFER_SIZE
           
 
Constructor Summary
CustomBufferedIndexInput(String resourceDesc)
           
CustomBufferedIndexInput(String resourceDesc, int bufferSize)
           
 
Method Summary
 IndexInput clone()
           
 void close()
           
protected abstract  void closeInternal()
           
protected  int flushBuffer(IndexOutput out, long numBytes)
          Flushes the in-memory bufer to the given output, copying at most numBytes.
 long getFilePointer()
           
 byte readByte()
           
 void readBytes(byte[] b, int offset, int len)
           
 void readBytes(byte[] b, int offset, int len, boolean useBuffer)
           
 int readInt()
           
protected abstract  void readInternal(byte[] b, int offset, int length)
          Expert: implements buffer refill.
 long readLong()
           
 int readVInt()
           
 long readVLong()
           
 void seek(long pos)
           
protected abstract  void seekInternal(long pos)
          Expert: implements seek.
 
Methods inherited from class org.apache.lucene.store.IndexInput
length, toString
 
Methods inherited from class org.apache.lucene.store.DataInput
readShort, readString, readStringSet, readStringStringMap
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BUFFER_SIZE

public static final int BUFFER_SIZE
See Also:
Constant Field Values

buffer

protected byte[] buffer
Constructor Detail

CustomBufferedIndexInput

public CustomBufferedIndexInput(String resourceDesc)

CustomBufferedIndexInput

public CustomBufferedIndexInput(String resourceDesc,
                                int bufferSize)
Method Detail

readByte

public byte readByte()
              throws IOException
Specified by:
readByte in class DataInput
Throws:
IOException

readBytes

public void readBytes(byte[] b,
                      int offset,
                      int len)
               throws IOException
Specified by:
readBytes in class DataInput
Throws:
IOException

readBytes

public void readBytes(byte[] b,
                      int offset,
                      int len,
                      boolean useBuffer)
               throws IOException
Overrides:
readBytes in class DataInput
Throws:
IOException

readInt

public int readInt()
            throws IOException
Overrides:
readInt in class DataInput
Throws:
IOException

readLong

public long readLong()
              throws IOException
Overrides:
readLong in class DataInput
Throws:
IOException

readVInt

public int readVInt()
             throws IOException
Overrides:
readVInt in class DataInput
Throws:
IOException

readVLong

public long readVLong()
               throws IOException
Overrides:
readVLong in class DataInput
Throws:
IOException

close

public final void close()
                 throws IOException
Specified by:
close in interface Closeable
Specified by:
close in class 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 IndexInput

seek

public void seek(long pos)
          throws IOException
Specified by:
seek in class 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:
readInternal(byte[],int,int)

clone

public IndexInput clone()
Overrides:
clone in class IndexInput

flushBuffer

protected int flushBuffer(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


Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.