org.elasticsearch.common.io.stream
Class LZFStreamInput

java.lang.Object
  extended by java.io.InputStream
      extended by org.elasticsearch.common.io.stream.StreamInput
          extended by org.elasticsearch.common.io.stream.LZFStreamInput
All Implemented Interfaces:
java.io.Closeable

public class LZFStreamInput
extends StreamInput


Field Summary
protected  boolean cfgFullReads
          Flag that indicates whether we force full reads (reading of as many bytes as requested), or 'optimal' reads (up to as many as available, but at least one).
protected  StreamInput inputStream
          stream to be decompressed
protected  boolean inputStreamClosed
          Flag that indicates if we have already called 'inputStream.close()' (to avoid calling it multiple times)
 
Fields inherited from class org.elasticsearch.common.io.stream.StreamInput
chararr
 
Constructor Summary
LZFStreamInput(StreamInput in, boolean cached)
           
 
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.
 void close()
          Closes the stream to further operations.
 int read()
           
 int read(byte[] buffer, int offset, int length)
           
 byte readByte()
          Reads and returns a single byte.
 void readBytes(byte[] b, int offset, int len)
          Reads a specified number of bytes into an array at the specified offset.
protected  boolean readyBuffer()
          Fill the uncompressed bytes buffer by reading the underlying inputStream.
 void reset()
          Resets the stream.
 void reset(StreamInput in)
           
 void resetToBufferStart()
          Expert!, resets to buffer start, without the need to decompress it again.
 
Methods inherited from class org.elasticsearch.common.io.stream.StreamInput
readBoolean, readDouble, readFloat, readFully, readInt, readLong, readShort, readUTF, readVInt, readVLong
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inputStream

protected StreamInput inputStream
stream to be decompressed


inputStreamClosed

protected boolean inputStreamClosed
Flag that indicates if we have already called 'inputStream.close()' (to avoid calling it multiple times)


cfgFullReads

protected boolean cfgFullReads
Flag that indicates whether we force full reads (reading of as many bytes as requested), or 'optimal' reads (up to as many as available, but at least one). Default is false, meaning that 'optimal' read is used.

Constructor Detail

LZFStreamInput

public LZFStreamInput(StreamInput in,
                      boolean cached)
Method Detail

available

public 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. 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.

Overrides:
available in class java.io.InputStream

read

public int read()
         throws java.io.IOException
Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] buffer,
                int offset,
                int length)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

readByte

public byte readByte()
              throws java.io.IOException
Description copied from class: StreamInput
Reads and returns a single byte.

Specified by:
readByte in class StreamInput
Throws:
java.io.IOException

readBytes

public void readBytes(byte[] b,
                      int offset,
                      int len)
               throws java.io.IOException
Description copied from class: StreamInput
Reads a specified number of bytes into an array at the specified offset.

Specified by:
readBytes in class StreamInput
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:
java.io.IOException

reset

public void reset()
           throws java.io.IOException
Description copied from class: StreamInput
Resets the stream.

Specified by:
reset in class StreamInput
Throws:
java.io.IOException

reset

public void reset(StreamInput in)
           throws java.io.IOException
Throws:
java.io.IOException

resetToBufferStart

public void resetToBufferStart()
Expert!, resets to buffer start, without the need to decompress it again.


close

public void close()
           throws java.io.IOException
Description copied from class: StreamInput
Closes the stream to further operations.

Specified by:
close in interface java.io.Closeable
Specified by:
close in class StreamInput
Throws:
java.io.IOException

readyBuffer

protected boolean readyBuffer()
                       throws java.io.IOException
Fill the uncompressed bytes buffer by reading the underlying inputStream.

Throws:
java.io.IOException