de.netseeker.ejoe.io
Class ByteBufferOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by de.netseeker.ejoe.io.ByteBufferOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class ByteBufferOutputStream
extends java.io.OutputStream

Implements an input stream for a NIO ByteBuffer. This class is based on an article found at the homepage of Michael W. Spille.

Since:
0.3.0
Author:
Michael W. Spille, netseeker aka Michael Manske

Constructor Summary
ByteBufferOutputStream()
           
ByteBufferOutputStream(java.nio.ByteBuffer buffer)
           
ByteBufferOutputStream(int startingSize)
           
 
Method Summary
 void close()
           
 void flush()
           
 java.nio.ByteBuffer getBackingBuffer()
           
 void putInt(int i)
           
 void reset()
          Reset the underlying byte buffer back to the starting state
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(java.nio.ByteBuffer b)
           
 void write(int b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteBufferOutputStream

public ByteBufferOutputStream()

ByteBufferOutputStream

public ByteBufferOutputStream(int startingSize)
Parameters:
startingSize -

ByteBufferOutputStream

public ByteBufferOutputStream(java.nio.ByteBuffer buffer)
Parameters:
buffer -
Method Detail

reset

public void reset()
Reset the underlying byte buffer back to the starting state


getBackingBuffer

public java.nio.ByteBuffer getBackingBuffer()
Returns:

write

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

write

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

write

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

write

public void write(java.nio.ByteBuffer b)
Parameters:
b -

putInt

public void putInt(int i)

flush

public void flush()
Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException


Copyright © 2005-2007 netseeker. All Rights Reserved.