JBoss Marshalling 1.3.0.CR9

org.jboss.marshalling
Class ByteOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.jboss.marshalling.SimpleByteOutput
          extended by org.jboss.marshalling.ByteOutputStream
All Implemented Interfaces:
Closeable, Flushable, ByteOutput
Direct Known Subclasses:
LimitedByteOutput, SimpleDataOutput

public class ByteOutputStream
extends SimpleByteOutput

An OutputStream which implements ByteOutput and writes bytes to another ByteOutput. Usually the Marshalling.createByteOutput(OutputStream) method should be used to create instances because it can detect when the target already implements ByteOutput.


Field Summary
protected  ByteOutput byteOutput
           
 
Constructor Summary
ByteOutputStream(ByteOutput byteOutput)
          Construct a new instance.
 
Method Summary
 void close()
          
 void flush()
          
 void write(byte[] b)
          Write all the bytes from the given array to the stream.
 void write(byte[] b, int off, int len)
          Write some of the bytes from the given array to the stream.
 void write(int b)
          Writes to the output stream the eight low-order bits of the argument b.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

byteOutput

protected volatile ByteOutput byteOutput
Constructor Detail

ByteOutputStream

public ByteOutputStream(ByteOutput byteOutput)
Construct a new instance.

Parameters:
byteOutput - the byte output to write to
Method Detail

write

public void write(int b)
           throws IOException
Writes to the output stream the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.

Specified by:
write in interface ByteOutput
Specified by:
write in class OutputStream
Parameters:
b - the byte to write
Throws:
IOException - if an error occurs

write

public void write(byte[] b)
           throws IOException
Write all the bytes from the given array to the stream.

Specified by:
write in interface ByteOutput
Overrides:
write in class OutputStream
Parameters:
b - the byte array
Throws:
IOException - if an error occurs

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Write some of the bytes from the given array to the stream.

Specified by:
write in interface ByteOutput
Overrides:
write in class OutputStream
Parameters:
b - the byte array
off - the index to start writing from
len - the number of bytes to write
Throws:
IOException - if an error occurs

flush

public void flush()
           throws IOException

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

close

public void close()
           throws IOException

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

JBoss Marshalling 1.3.0.CR9

Copyright © 2011 JBoss, a division of Red Hat, Inc.