org.elasticsearch.common.io.stream
Class StreamOutput

java.lang.Object
  extended by java.io.OutputStream
      extended by org.elasticsearch.common.io.stream.StreamOutput
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable
Direct Known Subclasses:
BytesStreamOutput, DataOutputStreamOutput, HandlesStreamOutput, LZFStreamOutput

public abstract class StreamOutput
extends java.io.OutputStream


Constructor Summary
StreamOutput()
           
 
Method Summary
abstract  void close()
          Closes this stream to further operations.
abstract  void flush()
          Forces any buffered output to be written.
abstract  void reset()
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 void writeBoolean(boolean b)
          Writes a boolean.
abstract  void writeByte(byte b)
          Writes a single byte.
 void writeBytes(byte[] b)
          Writes an array of bytes.
 void writeBytes(byte[] b, int length)
          Writes an array of bytes.
abstract  void writeBytes(byte[] b, int offset, int length)
          Writes an array of bytes.
 void writeDouble(double v)
           
 void writeFloat(float v)
           
 void writeInt(int i)
          Writes an int as four bytes.
 void writeLong(long i)
          Writes a long as eight bytes.
 void writeShort(short v)
           
 void writeUTF(java.lang.String str)
          Writes a string.
 void writeVInt(int i)
          Writes an int in a variable-length format.
 void writeVLong(long i)
          Writes an long in a variable-length format.
 
Methods inherited from class java.io.OutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamOutput

public StreamOutput()
Method Detail

writeByte

public abstract void writeByte(byte b)
                        throws java.io.IOException
Writes a single byte.

Throws:
java.io.IOException

writeBytes

public void writeBytes(byte[] b)
                throws java.io.IOException
Writes an array of bytes.

Parameters:
b - the bytes to write
Throws:
java.io.IOException

writeBytes

public void writeBytes(byte[] b,
                       int length)
                throws java.io.IOException
Writes an array of bytes.

Parameters:
b - the bytes to write
length - the number of bytes to write
Throws:
java.io.IOException

writeBytes

public abstract void writeBytes(byte[] b,
                                int offset,
                                int length)
                         throws java.io.IOException
Writes an array of bytes.

Parameters:
b - the bytes to write
offset - the offset in the byte array
length - the number of bytes to write
Throws:
java.io.IOException

writeShort

public final void writeShort(short v)
                      throws java.io.IOException
Throws:
java.io.IOException

writeInt

public void writeInt(int i)
              throws java.io.IOException
Writes an int as four bytes.

Throws:
java.io.IOException

writeVInt

public void writeVInt(int i)
               throws java.io.IOException
Writes an int in a variable-length format. Writes between one and five bytes. Smaller values take fewer bytes. Negative numbers are not supported.

Throws:
java.io.IOException

writeLong

public void writeLong(long i)
               throws java.io.IOException
Writes a long as eight bytes.

Throws:
java.io.IOException

writeVLong

public void writeVLong(long i)
                throws java.io.IOException
Writes an long in a variable-length format. Writes between one and five bytes. Smaller values take fewer bytes. Negative numbers are not supported.

Throws:
java.io.IOException

writeUTF

public void writeUTF(java.lang.String str)
              throws java.io.IOException
Writes a string.

Throws:
java.io.IOException

writeFloat

public void writeFloat(float v)
                throws java.io.IOException
Throws:
java.io.IOException

writeDouble

public void writeDouble(double v)
                 throws java.io.IOException
Throws:
java.io.IOException

writeBoolean

public void writeBoolean(boolean b)
                  throws java.io.IOException
Writes a boolean.

Throws:
java.io.IOException

flush

public abstract void flush()
                    throws java.io.IOException
Forces any buffered output to be written.

Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException

close

public abstract void close()
                    throws java.io.IOException
Closes this stream to further operations.

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

reset

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

write

public void write(int b)
           throws java.io.IOException
Specified by:
write in class java.io.OutputStream
Throws:
java.io.IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException