org.elasticsearch.common.compress
Class CompressedIndexInput<T extends CompressorContext>

java.lang.Object
  extended by org.apache.lucene.store.DataInput
      extended by org.apache.lucene.store.IndexInput
          extended by org.elasticsearch.common.compress.CompressedIndexInput<T>
All Implemented Interfaces:
Closeable, Cloneable
Direct Known Subclasses:
LZFCompressedIndexInput, SnappyCompressedIndexInput

public abstract class CompressedIndexInput<T extends CompressorContext>
extends org.apache.lucene.store.IndexInput


Field Summary
protected  T context
           
protected  byte[] uncompressed
           
protected  int uncompressedLength
           
 
Constructor Summary
CompressedIndexInput(org.apache.lucene.store.IndexInput in, T context)
           
 
Method Summary
 int available()
          Method is overridden to report number of bytes that can now be read from decoded data buffer, without reading bytes from the underlying stream.
 Object clone()
           
 void close()
           
protected abstract  void doClose()
           
 long getFilePointer()
           
 long length()
           
 int read(byte[] buffer, int offset, int length, boolean fullRead)
           
 byte readByte()
           
 void readBytes(byte[] b, int offset, int len)
           
protected abstract  void readHeader(org.apache.lucene.store.IndexInput in)
           
protected  boolean readyBuffer()
           
 void seek(long pos)
           
protected abstract  int uncompress(org.apache.lucene.store.IndexInput in, byte[] out)
          Uncompress the data into the out array, returning the size uncompressed
 
Methods inherited from class org.apache.lucene.store.IndexInput
copyBytes, skipChars, toString
 
Methods inherited from class org.apache.lucene.store.DataInput
readBytes, readChars, readInt, readLong, readShort, readString, readStringStringMap, readVInt, readVLong, setModifiedUTF8StringsMode
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

context

protected final T extends CompressorContext context

uncompressed

protected byte[] uncompressed

uncompressedLength

protected int uncompressedLength
Constructor Detail

CompressedIndexInput

public CompressedIndexInput(org.apache.lucene.store.IndexInput in,
                            T context)
                     throws IOException
Throws:
IOException
Method Detail

available

public int available()
              throws IOException
Method is overridden to report number of bytes that can now be read from decoded data buffer, without reading bytes from the underlying stream. Never throws an exception; returns number of bytes available without further reads from underlying source; -1 if stream has been closed, or 0 if an actual read (and possible blocking) is needed to find out.

Throws:
IOException

readByte

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

read

public int read(byte[] buffer,
                int offset,
                int length,
                boolean fullRead)
         throws IOException
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

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

length

public long length()
Specified by:
length in class org.apache.lucene.store.IndexInput

close

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

doClose

protected abstract void doClose()
                         throws IOException
Throws:
IOException

readyBuffer

protected boolean readyBuffer()
                       throws IOException
Throws:
IOException

readHeader

protected abstract void readHeader(org.apache.lucene.store.IndexInput in)
                            throws IOException
Throws:
IOException

uncompress

protected abstract int uncompress(org.apache.lucene.store.IndexInput in,
                                  byte[] out)
                           throws IOException
Uncompress the data into the out array, returning the size uncompressed

Throws:
IOException

clone

public Object clone()
Overrides:
clone in class org.apache.lucene.store.DataInput


Copyright © 2009-2012. All Rights Reserved.