com.github.libxjava.io
Class ByteArrayBuffer.Writer

java.lang.Object
  extended by java.io.OutputStream
      extended by com.github.libxjava.io.ByteArrayBuffer.Writer
All Implemented Interfaces:
Closeable, Flushable
Enclosing class:
ByteArrayBuffer

public final class ByteArrayBuffer.Writer
extends OutputStream


Constructor Summary
ByteArrayBuffer.Writer()
           
 
Method Summary
 void close()
           
 void flush()
          Same as markComplete().
 void markComplete()
          Notifies the buffer that the current chunk of data is complete.
 void markIncomplete()
          Notifies the buffer that the current chunk is incomplete and should be discarded.
 int space()
          Returns the remaing space in the buffer.
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int v)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayBuffer.Writer

public ByteArrayBuffer.Writer()
Method Detail

space

public int space()
Returns the remaing space in the buffer.


close

public void close()
Specified by:
close in interface Closeable
Overrides:
close in class OutputStream

flush

public void flush()
Same as markComplete().

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

write

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

write

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

write

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

markComplete

public void markComplete()
Notifies the buffer that the current chunk of data is complete.


markIncomplete

public void markIncomplete()
Notifies the buffer that the current chunk is incomplete and should be discarded. This notification is handed over to the reader with an IOException in a subsequent call to one of the read methods (ByteArrayBuffer.Reader.read(), ByteArrayBuffer.Reader.read(byte[]), ByteArrayBuffer.Reader.read(byte[], int, int)).



Copyright © 2010 Marcel Patzlaff. All Rights Reserved.