org.jibx.runtime.impl
Interface IOutByteBuffer

All Superinterfaces:
IByteBuffer
All Known Implementing Classes:
OutByteBuffer

public interface IOutByteBuffer
extends IByteBuffer

Output buffer interface. This extends the basic byte array buffer interface with methods specifically for output. Client code needs to obey the access rules stated in the method documentation, including the documentation for the base interface methods.

Author:
Dennis M. Sosnoski

Method Summary
 void flush()
          Empty the buffer.
 void free(int reserve, int size)
          Free at least some number of bytes of space in the byte array.
 
Methods inherited from interface org.jibx.runtime.impl.IByteBuffer
finish, getBuffer, getOffset, setOffset
 

Method Detail

free

void free(int reserve,
          int size)
          throws java.io.IOException
Free at least some number of bytes of space in the byte array. If no reserve is specified, this call may write all data up to the current offset to the output stream, and if necessary will replace the byte array with a larger array. If a reserve is specified, only data up to the reserve will be written, and any remaining data will be moved down to the start of the (possibly new) byte array on return. Both IByteBuffer.getBuffer() and IByteBuffer.getOffset() must always be called again before any further use of the buffer.

Parameters:
reserve - offset of data to be preserved in buffer (nothing preserved if greater than or equal to current offset)
size - desired number of bytes
Throws:
java.io.IOException

flush

void flush()
           throws java.io.IOException
Empty the buffer. Writes all data from the buffer to the output stream, resetting the offset to the logical start of the buffer (which may not be offset zero, since implementations may add some sort of header). This method is guaranteed not to replace the byte array, but IByteBuffer.getOffset() must always be called again before any further use of the buffer.

Throws:
java.io.IOException


Project Web Site