JBoss Marshalling 1.2.1.GA

org.jboss.marshalling
Class NioByteOutput

java.lang.Object
  extended by java.io.OutputStream
      extended by org.jboss.marshalling.NioByteOutput
All Implemented Interfaces:
Closeable, Flushable, ByteOutput

public class NioByteOutput
extends OutputStream
implements ByteOutput

A ByteOutput implementation which writes out ByteBuffers to a consumer.


Nested Class Summary
static interface NioByteOutput.BufferWriter
          A buffer writer for an NioByteOutput.
 
Constructor Summary
NioByteOutput(NioByteOutput.BufferWriter bufferWriterTask)
          Construct a new instance.
 
Method Summary
 void close()
          
 void flush()
          
 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.io.OutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.marshalling.ByteOutput
write
 

Constructor Detail

NioByteOutput

public NioByteOutput(NioByteOutput.BufferWriter bufferWriterTask)
Construct a new instance. The internal buffers will have a capacity of bufferSize. The given bufferWriterTask will be called to send buffers, flush the output stream, and handle the end-of-file condition.

Parameters:
bufferWriterTask - the writer task
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,
                  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.2.1.GA

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