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:
Closeable, Flushable
Direct Known Subclasses:
AdapterStreamOutput, BytesStreamOutput, CompressedStreamOutput, DataOutputStreamOutput, OutputStreamStreamOutput

public abstract class StreamOutput
extends 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.
 long position()
           
abstract  void reset()
           
 void seek(long position)
           
 boolean seekPositionSupported()
           
 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 writeBytesReference(BytesReference bytes)
          Writes the bytes reference, including a length header.
 void writeDouble(double v)
           
 void writeFloat(float v)
           
 void writeGenericValue(Object value)
           
 void writeInt(int i)
          Writes an int as four bytes.
 void writeLong(long i)
          Writes a long as eight bytes.
 void writeMap(Map<String,Object> map)
           
 void writeOptionalString(String str)
           
 void writeOptionalUTF(String str)
          Deprecated. 
 void writeShort(short v)
           
 void writeString(String str)
           
 void writeStringArray(String[] array)
           
 void writeText(Text text)
           
 void writeUTF(String str)
          Deprecated. use writeString(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

seekPositionSupported

public boolean seekPositionSupported()

position

public long position()
              throws IOException
Throws:
IOException

seek

public void seek(long position)
          throws IOException
Throws:
IOException

writeByte

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

Throws:
IOException

writeBytes

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

Parameters:
b - the bytes to write
Throws:
IOException

writeBytes

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

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

writeBytes

public abstract void writeBytes(byte[] b,
                                int offset,
                                int length)
                         throws 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:
IOException

writeBytesReference

public void writeBytesReference(@Nullable
                                BytesReference bytes)
                         throws IOException
Writes the bytes reference, including a length header.

Throws:
IOException

writeShort

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

writeInt

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

Throws:
IOException

writeVInt

public void writeVInt(int i)
               throws 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:
IOException

writeLong

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

Throws:
IOException

writeVLong

public void writeVLong(long i)
                throws 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:
IOException

writeOptionalUTF

@Deprecated
public void writeOptionalUTF(@Nullable
                                        String str)
                      throws IOException
Deprecated. 

Throws:
IOException

writeOptionalString

public void writeOptionalString(@Nullable
                                String str)
                         throws IOException
Throws:
IOException

writeText

public void writeText(Text text)
               throws IOException
Throws:
IOException

writeString

public void writeString(String str)
                 throws IOException
Throws:
IOException

writeUTF

@Deprecated
public void writeUTF(String str)
              throws IOException
Deprecated. use writeString(String)

Writes a string.

Throws:
IOException

writeFloat

public void writeFloat(float v)
                throws IOException
Throws:
IOException

writeDouble

public void writeDouble(double v)
                 throws IOException
Throws:
IOException

writeBoolean

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

Throws:
IOException

flush

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

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

close

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

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

reset

public abstract void reset()
                    throws IOException
Throws:
IOException

write

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

write

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

writeStringArray

public void writeStringArray(String[] array)
                      throws IOException
Throws:
IOException

writeMap

public void writeMap(@Nullable
                     Map<String,Object> map)
              throws IOException
Throws:
IOException

writeGenericValue

public void writeGenericValue(@Nullable
                              Object value)
                       throws IOException
Throws:
IOException


Copyright © 2009-2012. All Rights Reserved.