com.google.protobuf
Class ByteString.Output

java.lang.Object
  extended by java.io.OutputStream
      extended by com.google.protobuf.ByteString.Output
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable
Enclosing class:
ByteString

public static final class ByteString.Output
extends java.io.OutputStream

Outputs to a ByteString instance. Call toByteString() to create the ByteString instance.


Method Summary
 void reset()
          Resets this stream, so that all currently accumulated output in the output stream is discarded.
 int size()
          Returns the current size of the output stream.
 ByteString toByteString()
          Creates a byte string.
 java.lang.String toString()
           
 void write(byte[] b, int offset, int length)
           
 void write(int b)
           
 void writeTo(java.io.OutputStream out)
          Writes the complete contents of this byte array output stream to the specified output stream argument.
 
Methods inherited from class java.io.OutputStream
close, flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

write

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

write

public void write(byte[] b,
                  int offset,
                  int length)
Overrides:
write in class java.io.OutputStream

toByteString

public ByteString toByteString()
Creates a byte string. Its size is the current size of this output stream and its output has been copied to it.

Returns:
the current contents of this output stream, as a byte string.

writeTo

public void writeTo(java.io.OutputStream out)
             throws java.io.IOException
Writes the complete contents of this byte array output stream to the specified output stream argument.

Parameters:
out - the output stream to which to write the data.
Throws:
java.io.IOException - if an I/O error occurs.

size

public int size()
Returns the current size of the output stream.

Returns:
the current size of the output stream

reset

public void reset()
Resets this stream, so that all currently accumulated output in the output stream is discarded. The output stream can be used again, reusing the already allocated buffer space.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object