Package org.jibx.runtime.impl
Interface IByteBuffer
-
- All Known Subinterfaces:
IInByteBuffer
,IOutByteBuffer
- All Known Implementing Classes:
InByteBuffer
,OutByteBuffer
public interface IByteBuffer
Input or output buffer interface. It exposes a byte array buffer directly for use by client code, to allow efficient buffering of data without copying. This obviously requires client code to be careful to obey the access rules stated in the method documentation.- Author:
- Dennis M. Sosnoski
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
finish()
Complete usage of the buffer.byte[]
getBuffer()
Get the byte array buffer.int
getOffset()
Get the current offset.void
setOffset(int offset)
Set the current offset.
-
-
-
Method Detail
-
getBuffer
byte[] getBuffer()
Get the byte array buffer.- Returns:
- array
-
getOffset
int getOffset()
Get the current offset. For an input buffer this is the index of the next byte to be read, for an output buffer it is the index to store the next byte to be written. After reading or writing data, thesetOffset(int)
method must be used to update the current offset before any other operations are performed on the buffer.- Returns:
- offset
-
setOffset
void setOffset(int offset)
Set the current offset. This method must be used to update the internal buffer state after reading or writing any data.- Parameters:
offset
-
-
finish
void finish() throws java.io.IOException
Complete usage of the buffer. This method should be called whenever the application is done reading or writing the buffer. After this method is called the buffer may need to be reinitialized (such as by setting a new input or output stream) before it is reused.- Throws:
java.io.IOException
-
-