org.entityfs.support.io
Class WritableByteBufferChannel

java.lang.Object
  extended by org.entityfs.support.io.WritableByteBufferChannel
All Implemented Interfaces:
Closeable, Channel, WritableByteChannel

public class WritableByteBufferChannel
extends Object
implements WritableByteChannel

This is a WritableByteChannel that writes its data to a pre-allocated ByteBuffer. It assumes exclusive access to the buffer.

Writing operations will update the supplied buffer's internal position.

Since:
1.0
Author:
Karl Gustafsson

Constructor Summary
WritableByteBufferChannel(ByteBuffer buffer)
           
WritableByteBufferChannel(ByteBuffer buffer, int tempBufferSize)
           
 
Method Summary
 void close()
           
 boolean isOpen()
           
 int write(ByteBuffer src)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WritableByteBufferChannel

public WritableByteBufferChannel(ByteBuffer buffer,
                                 int tempBufferSize)
                          throws IllegalArgumentException
Throws:
IllegalArgumentException

WritableByteBufferChannel

public WritableByteBufferChannel(ByteBuffer buffer)
Method Detail

write

public int write(ByteBuffer src)
          throws IOException
Specified by:
write in interface WritableByteChannel
Throws:
IOException

isOpen

public boolean isOpen()
Specified by:
isOpen in interface Channel

close

public void close()
Specified by:
close in interface Closeable
Specified by:
close in interface Channel