org.elasticsearch.common.io.stream
Class StreamInput

java.lang.Object
  extended by java.io.InputStream
      extended by org.elasticsearch.common.io.stream.StreamInput
All Implemented Interfaces:
Closeable
Direct Known Subclasses:
AdapterStreamInput, ByteBufferStreamInput, BytesStreamInput, ChannelBufferStreamInput, CompressedStreamInput, InputStreamStreamInput

public abstract class StreamInput
extends InputStream


Constructor Summary
StreamInput()
           
 
Method Summary
abstract  void close()
          Closes the stream to further operations.
 boolean readBoolean()
          Reads a boolean.
abstract  byte readByte()
          Reads and returns a single byte.
abstract  void readBytes(byte[] b, int offset, int len)
          Reads a specified number of bytes into an array at the specified offset.
 BytesReference readBytesReference()
          Reads a bytes reference from this stream, might hold an actual reference to the underlying bytes of the stream.
 BytesReference readBytesReference(int length)
          Reads a bytes reference from this stream, might hold an actual reference to the underlying bytes of the stream.
 double readDouble()
           
 float readFloat()
           
 void readFully(byte[] b)
           
 Object readGenericValue()
           
 int readInt()
          Reads four bytes and returns an int.
 long readLong()
          Reads eight bytes and returns a long.
 Map<String,Object> readMap()
           
 String readOptionalString()
           
 String readOptionalUTF()
          Deprecated. use readOptionalString()
 short readShort()
           
 String readString()
           
 String[] readStringArray()
           
 Text readText()
           
 String readUTF()
          Deprecated. use readString()
 int readVInt()
          Reads an int stored in variable-length format.
 long readVLong()
          Reads a long stored in variable-length format.
abstract  void reset()
          Resets the stream.
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, read, read, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamInput

public StreamInput()
Method Detail

readByte

public abstract byte readByte()
                       throws IOException
Reads and returns a single byte.

Throws:
IOException

readBytes

public abstract void readBytes(byte[] b,
                               int offset,
                               int len)
                        throws IOException
Reads a specified number of bytes into an array at the specified offset.

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:
IOException

readBytesReference

public BytesReference readBytesReference()
                                  throws IOException
Reads a bytes reference from this stream, might hold an actual reference to the underlying bytes of the stream.

Throws:
IOException

readBytesReference

public BytesReference readBytesReference(int length)
                                  throws IOException
Reads a bytes reference from this stream, might hold an actual reference to the underlying bytes of the stream.

Throws:
IOException

readFully

public void readFully(byte[] b)
               throws IOException
Throws:
IOException

readShort

public short readShort()
                throws IOException
Throws:
IOException

readInt

public int readInt()
            throws IOException
Reads four bytes and returns an int.

Throws:
IOException

readVInt

public int readVInt()
             throws IOException
Reads an int stored in variable-length format. Reads between one and five bytes. Smaller values take fewer bytes. Negative numbers are not supported.

Throws:
IOException

readLong

public long readLong()
              throws IOException
Reads eight bytes and returns a long.

Throws:
IOException

readVLong

public long readVLong()
               throws IOException
Reads a long stored in variable-length format. Reads between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.

Throws:
IOException

readOptionalUTF

@Nullable
@Deprecated
public String readOptionalUTF()
                       throws IOException
Deprecated. use readOptionalString()

Throws:
IOException

readText

public Text readText()
              throws IOException
Throws:
IOException

readOptionalString

@Nullable
public String readOptionalString()
                          throws IOException
Throws:
IOException

readString

public String readString()
                  throws IOException
Throws:
IOException

readUTF

@Deprecated
public String readUTF()
               throws IOException
Deprecated. use readString()

Throws:
IOException

readFloat

public final float readFloat()
                      throws IOException
Throws:
IOException

readDouble

public final double readDouble()
                        throws IOException
Throws:
IOException

readBoolean

public final boolean readBoolean()
                          throws IOException
Reads a boolean.

Throws:
IOException

reset

public abstract void reset()
                    throws IOException
Resets the stream.

Overrides:
reset in class InputStream
Throws:
IOException

close

public abstract void close()
                    throws IOException
Closes the stream to further operations.

Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException

readStringArray

public String[] readStringArray()
                         throws IOException
Throws:
IOException

readMap

@Nullable
public Map<String,Object> readMap()
                           throws IOException
Throws:
IOException

readGenericValue

@Nullable
public Object readGenericValue()
                        throws IOException
Throws:
IOException


Copyright © 2009-2012. All Rights Reserved.