Package com.google.flatbuffers
Class FlatBufferBuilder
- java.lang.Object
 - 
- com.google.flatbuffers.FlatBufferBuilder
 
 
- 
public class FlatBufferBuilder extends java.lang.ObjectClass that helps you build a FlatBuffer. See the section "Use in Java/C#" in the main FlatBuffers documentation. 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFlatBufferBuilder.ByteBufferFactoryAn interface that provides a user of the FlatBufferBuilder class the ability to specify the method in which the internal buffer gets allocated.static classFlatBufferBuilder.HeapByteBufferFactoryAn implementation of the ByteBufferFactory interface that is used when one is not provided by the user. 
- 
Constructor Summary
Constructors Constructor Description FlatBufferBuilder()Start with a buffer of 1KiB, then grow as required.FlatBufferBuilder(int initial_size)Start with a buffer of size `initial_size`, then grow as required.FlatBufferBuilder(int initial_size, FlatBufferBuilder.ByteBufferFactory bb_factory)Start with a buffer of size `initial_size`, then grow as required.FlatBufferBuilder(int initial_size, FlatBufferBuilder.ByteBufferFactory bb_factory, java.nio.ByteBuffer existing_bb, Utf8 utf8)Start with a buffer of size `initial_size`, then grow as required.FlatBufferBuilder(java.nio.ByteBuffer existing_bb)Alternative constructor allowing reuse ofByteBuffers.FlatBufferBuilder(java.nio.ByteBuffer existing_bb, FlatBufferBuilder.ByteBufferFactory bb_factory)Alternative constructor allowing reuse ofByteBuffers. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBoolean(boolean x)Add a `boolean` to the buffer, properly aligned, and grows the buffer (if necessary).voidaddBoolean(int o, boolean x, boolean d)Add a `boolean` to a table at `o` into its vtable, with value `x` and default `d`.voidaddByte(byte x)Add a `byte` to the buffer, properly aligned, and grows the buffer (if necessary).voidaddByte(int o, byte x, int d)Add a `byte` to a table at `o` into its vtable, with value `x` and default `d`.voidaddDouble(double x)Add a `double` to the buffer, properly aligned, and grows the buffer (if necessary).voidaddDouble(int o, double x, double d)Add a `double` to a table at `o` into its vtable, with value `x` and default `d`.voidaddFloat(float x)Add a `float` to the buffer, properly aligned, and grows the buffer (if necessary).voidaddFloat(int o, float x, double d)Add a `float` to a table at `o` into its vtable, with value `x` and default `d`.voidaddInt(int x)Add an `int` to the buffer, properly aligned, and grows the buffer (if necessary).voidaddInt(int o, int x, int d)Add an `int` to a table at `o` into its vtable, with value `x` and default `d`.voidaddLong(int o, long x, long d)Add a `long` to a table at `o` into its vtable, with value `x` and default `d`.voidaddLong(long x)Add a `long` to the buffer, properly aligned, and grows the buffer (if necessary).voidaddOffset(int off)Adds on offset, relative to where it will be written.voidaddOffset(int o, int x, int d)Add an `offset` to a table at `o` into its vtable, with value `x` and default `d`.voidaddShort(int o, short x, int d)Add a `short` to a table at `o` into its vtable, with value `x` and default `d`.voidaddShort(short x)Add a `short` to the buffer, properly aligned, and grows the buffer (if necessary).voidaddStruct(int voffset, int x, int d)Add a struct to the table.voidclear()Reset the FlatBufferBuilder by purging all data that it holds.intcreateByteVector(byte[] arr)Create a byte array in the buffer.intcreateByteVector(byte[] arr, int offset, int length)Create a byte array in the buffer.intcreateByteVector(java.nio.ByteBuffer byteBuffer)Create a byte array in the buffer.<T extends Table>
intcreateSortedVectorOfTables(T obj, int[] offsets)Create a vector of sorted by the key tables.intcreateString(java.lang.CharSequence s)Encode the string `s` in the buffer using UTF-8.intcreateString(java.nio.ByteBuffer s)Create a string in the buffer from an already encoded UTF-8 string in a ByteBuffer.java.nio.ByteBuffercreateUnintializedVector(int elem_size, int num_elems, int alignment)Create a new array/vector and return a ByteBuffer to be filled later.intcreateVectorOfTables(int[] offsets)Create a vector of tables.java.nio.ByteBufferdataBuffer()Get the ByteBuffer representing the FlatBuffer.intendObject()Finish off writing the object that is under construction.intendVector()Finish off the creation of an array and all its elements.voidfinish(int root_table)Finalize a buffer, pointing to the given `root_table`.voidfinish(int root_table, java.lang.String file_identifier)Finalize a buffer, pointing to the given `root_table`.voidfinished()Should not be accessing the final buffer before it is finished.voidfinishSizePrefixed(int root_table)Finalize a buffer, pointing to the given `root_table`, with the size prefixed.voidfinishSizePrefixed(int root_table, java.lang.String file_identifier)Finalize a buffer, pointing to the given `root_table`, with the size prefixed.FlatBufferBuilderforceDefaults(boolean forceDefaults)In order to save space, fields that are set to their default value don't get serialized into the buffer.FlatBufferBuilderinit(java.nio.ByteBuffer existing_bb, FlatBufferBuilder.ByteBufferFactory bb_factory)Alternative initializer that allows reusing this object on an existing `ByteBuffer`.static booleanisFieldPresent(Table table, int offset)Helper function to test if a field is present in the tablevoidNested(int obj)Structures are always stored inline, they need to be created right where they're used.voidnotNested()Should not be creating any other object, string or vector while an object is being constructed.intoffset()Offset relative to the end of the buffer.voidpad(int byte_size)Add zero valued bytes to prepare a new entry to be added.voidprep(int size, int additional_bytes)Prepare to write an element of `size` after `additional_bytes` have been written, e.g. if you write a string, you need to align such the int length field is aligned toConstants.SIZEOF_INT, and the string data follows it directly.voidputBoolean(boolean x)Add a `boolean` to the buffer, backwards from the current location.voidputByte(byte x)Add a `byte` to the buffer, backwards from the current location.voidputDouble(double x)Add a `double` to the buffer, backwards from the current location.voidputFloat(float x)Add a `float` to the buffer, backwards from the current location.voidputInt(int x)Add an `int` to the buffer, backwards from the current location.voidputLong(long x)Add a `long` to the buffer, backwards from the current location.voidputShort(short x)Add a `short` to the buffer, backwards from the current location.voidrequired(int table, int field)Checks that a required field has been set in a given table that has just been constructed.byte[]sizedByteArray()A utility function to copy and return the ByteBuffer data as a `byte[]`.byte[]sizedByteArray(int start, int length)A utility function to copy and return the ByteBuffer data from `start` to `start` + `length` as a `byte[]`.java.io.InputStreamsizedInputStream()A utility function to return an InputStream to the ByteBuffer datavoidslot(int voffset)Set the current vtable at `voffset` to the current location in the buffer.voidstartObject(int numfields)Start encoding a new object in the buffer.voidstartVector(int elem_size, int num_elems, int alignment)Start a new array/vector of objects. 
 - 
 
- 
- 
Constructor Detail
- 
FlatBufferBuilder
public FlatBufferBuilder(int initial_size, FlatBufferBuilder.ByteBufferFactory bb_factory)Start with a buffer of size `initial_size`, then grow as required.- Parameters:
 initial_size- The initial size of the internal buffer to use.bb_factory- The factory to be used for allocating the internal buffer
 
- 
FlatBufferBuilder
public FlatBufferBuilder(int initial_size, FlatBufferBuilder.ByteBufferFactory bb_factory, java.nio.ByteBuffer existing_bb, Utf8 utf8)Start with a buffer of size `initial_size`, then grow as required.- Parameters:
 initial_size- The initial size of the internal buffer to use.bb_factory- The factory to be used for allocating the internal bufferexisting_bb- The byte buffer to reuse.utf8- The Utf8 codec
 
- 
FlatBufferBuilder
public FlatBufferBuilder(int initial_size)
Start with a buffer of size `initial_size`, then grow as required.- Parameters:
 initial_size- The initial size of the internal buffer to use.
 
- 
FlatBufferBuilder
public FlatBufferBuilder()
Start with a buffer of 1KiB, then grow as required. 
- 
FlatBufferBuilder
public FlatBufferBuilder(java.nio.ByteBuffer existing_bb, FlatBufferBuilder.ByteBufferFactory bb_factory)Alternative constructor allowing reuse ofByteBuffers. The builder can still grow the buffer as necessary. User classes should make sure to calldataBuffer()to obtain the resulting encoded message.- Parameters:
 existing_bb- The byte buffer to reuse.bb_factory- The factory to be used for allocating a new internal buffer if the existing buffer needs to grow
 
- 
FlatBufferBuilder
public FlatBufferBuilder(java.nio.ByteBuffer existing_bb)
Alternative constructor allowing reuse ofByteBuffers. The builder can still grow the buffer as necessary. User classes should make sure to calldataBuffer()to obtain the resulting encoded message.- Parameters:
 existing_bb- The byte buffer to reuse.
 
 - 
 
- 
Method Detail
- 
init
public FlatBufferBuilder init(java.nio.ByteBuffer existing_bb, FlatBufferBuilder.ByteBufferFactory bb_factory)
Alternative initializer that allows reusing this object on an existing `ByteBuffer`. This method resets the builder's internal state, but keeps objects that have been allocated for temporary storage.- Parameters:
 existing_bb- The byte buffer to reuse.bb_factory- The factory to be used for allocating a new internal buffer if the existing buffer needs to grow- Returns:
 - Returns `this`.
 
 
- 
isFieldPresent
public static boolean isFieldPresent(Table table, int offset)
Helper function to test if a field is present in the table- Parameters:
 table- Flatbuffer tableoffset- virtual table offset- Returns:
 - true if the filed is present
 
 
- 
clear
public void clear()
Reset the FlatBufferBuilder by purging all data that it holds. 
- 
offset
public int offset()
Offset relative to the end of the buffer.- Returns:
 - Offset relative to the end of the buffer.
 
 
- 
pad
public void pad(int byte_size)
Add zero valued bytes to prepare a new entry to be added.- Parameters:
 byte_size- Number of bytes to add.
 
- 
prep
public void prep(int size, int additional_bytes)Prepare to write an element of `size` after `additional_bytes` have been written, e.g. if you write a string, you need to align such the int length field is aligned toConstants.SIZEOF_INT, and the string data follows it directly. If all you need to do is alignment, `additional_bytes` will be 0.- Parameters:
 size- This is the of the new element to write.additional_bytes- The padding size.
 
- 
putBoolean
public void putBoolean(boolean x)
Add a `boolean` to the buffer, backwards from the current location. Doesn't align nor check for space.- Parameters:
 x- A `boolean` to put into the buffer.
 
- 
putByte
public void putByte(byte x)
Add a `byte` to the buffer, backwards from the current location. Doesn't align nor check for space.- Parameters:
 x- A `byte` to put into the buffer.
 
- 
putShort
public void putShort(short x)
Add a `short` to the buffer, backwards from the current location. Doesn't align nor check for space.- Parameters:
 x- A `short` to put into the buffer.
 
- 
putInt
public void putInt(int x)
Add an `int` to the buffer, backwards from the current location. Doesn't align nor check for space.- Parameters:
 x- An `int` to put into the buffer.
 
- 
putLong
public void putLong(long x)
Add a `long` to the buffer, backwards from the current location. Doesn't align nor check for space.- Parameters:
 x- A `long` to put into the buffer.
 
- 
putFloat
public void putFloat(float x)
Add a `float` to the buffer, backwards from the current location. Doesn't align nor check for space.- Parameters:
 x- A `float` to put into the buffer.
 
- 
putDouble
public void putDouble(double x)
Add a `double` to the buffer, backwards from the current location. Doesn't align nor check for space.- Parameters:
 x- A `double` to put into the buffer.
 
- 
addBoolean
public void addBoolean(boolean x)
Add a `boolean` to the buffer, properly aligned, and grows the buffer (if necessary).- Parameters:
 x- A `boolean` to put into the buffer.
 
- 
addByte
public void addByte(byte x)
Add a `byte` to the buffer, properly aligned, and grows the buffer (if necessary).- Parameters:
 x- A `byte` to put into the buffer.
 
- 
addShort
public void addShort(short x)
Add a `short` to the buffer, properly aligned, and grows the buffer (if necessary).- Parameters:
 x- A `short` to put into the buffer.
 
- 
addInt
public void addInt(int x)
Add an `int` to the buffer, properly aligned, and grows the buffer (if necessary).- Parameters:
 x- An `int` to put into the buffer.
 
- 
addLong
public void addLong(long x)
Add a `long` to the buffer, properly aligned, and grows the buffer (if necessary).- Parameters:
 x- A `long` to put into the buffer.
 
- 
addFloat
public void addFloat(float x)
Add a `float` to the buffer, properly aligned, and grows the buffer (if necessary).- Parameters:
 x- A `float` to put into the buffer.
 
- 
addDouble
public void addDouble(double x)
Add a `double` to the buffer, properly aligned, and grows the buffer (if necessary).- Parameters:
 x- A `double` to put into the buffer.
 
- 
addOffset
public void addOffset(int off)
Adds on offset, relative to where it will be written.- Parameters:
 off- The offset to add.
 
- 
startVector
public void startVector(int elem_size, int num_elems, int alignment)Start a new array/vector of objects. Users usually will not call this directly. The `FlatBuffers` compiler will create a start/end method for vector types in generated code.The expected sequence of calls is:
- Start the array using this method.
 - Call 
addOffset(int)`num_elems` number of times to set the offset of each element in the array. - Call 
endVector()to retrieve the offset of the array. 
For example, to create an array of strings, do:
// Need 10 strings FlatBufferBuilder builder = new FlatBufferBuilder(existingBuffer); int[] offsets = new int[10]; for (int i = 0; i < 10; i++) { offsets[i] = fbb.createString(" " + i); } // Have the strings in the buffer, but don't have a vector. // Add a vector that references the newly created strings: builder.startVector(4, offsets.length, 4); // Add each string to the newly created vector // The strings are added in reverse order since the buffer // is filled in back to front for (int i = offsets.length - 1; i >= 0; i--) { builder.addOffset(offsets[i]); } // Finish off the vector int offsetOfTheVector = fbb.endVector();- Parameters:
 elem_size- The size of each element in the array.num_elems- The number of elements in the array.alignment- The alignment of the array.
 
- 
endVector
public int endVector()
Finish off the creation of an array and all its elements. The array must be created withstartVector(int, int, int).- Returns:
 - The offset at which the newly created array starts.
 - See Also:
 startVector(int, int, int)
 
- 
createUnintializedVector
public java.nio.ByteBuffer createUnintializedVector(int elem_size, int num_elems, int alignment)Create a new array/vector and return a ByteBuffer to be filled later. CallendVector()after this method to get an offset to the beginning of vector.- Parameters:
 elem_size- the size of each element in bytes.num_elems- number of elements in the vector.alignment- byte alignment.- Returns:
 - ByteBuffer with position and limit set to the space allocated for the array.
 
 
- 
createVectorOfTables
public int createVectorOfTables(int[] offsets)
Create a vector of tables.- Parameters:
 offsets- Offsets of the tables.- Returns:
 - Returns offset of the vector.
 
 
- 
createSortedVectorOfTables
public <T extends Table> int createSortedVectorOfTables(T obj, int[] offsets)
Create a vector of sorted by the key tables.- Parameters:
 obj- Instance of the table subclass.offsets- Offsets of the tables.- Returns:
 - Returns offset of the sorted vector.
 
 
- 
createString
public int createString(java.lang.CharSequence s)
Encode the string `s` in the buffer using UTF-8. Ifsis already aCharBuffer, this method is allocation free.- Parameters:
 s- The string to encode.- Returns:
 - The offset in the buffer where the encoded string starts.
 
 
- 
createString
public int createString(java.nio.ByteBuffer s)
Create a string in the buffer from an already encoded UTF-8 string in a ByteBuffer.- Parameters:
 s- An already encoded UTF-8 string as a `ByteBuffer`.- Returns:
 - The offset in the buffer where the encoded string starts.
 
 
- 
createByteVector
public int createByteVector(byte[] arr)
Create a byte array in the buffer.- Parameters:
 arr- A source array with data- Returns:
 - The offset in the buffer where the encoded array starts.
 
 
- 
createByteVector
public int createByteVector(byte[] arr, int offset, int length)Create a byte array in the buffer.- Parameters:
 arr- a source array with data.offset- the offset in the source array to start copying from.length- the number of bytes to copy from the source array.- Returns:
 - The offset in the buffer where the encoded array starts.
 
 
- 
createByteVector
public int createByteVector(java.nio.ByteBuffer byteBuffer)
Create a byte array in the buffer. The sourceByteBufferposition is advanced byBuffer.remaining()places after this call.- Parameters:
 byteBuffer- A sourceByteBufferwith data.- Returns:
 - The offset in the buffer where the encoded array starts.
 
 
- 
finished
public void finished()
Should not be accessing the final buffer before it is finished. 
- 
notNested
public void notNested()
Should not be creating any other object, string or vector while an object is being constructed. 
- 
Nested
public void Nested(int obj)
Structures are always stored inline, they need to be created right where they're used. You'll get this assertion failure if you created it elsewhere.- Parameters:
 obj- The offset of the created object.
 
- 
startObject
public void startObject(int numfields)
Start encoding a new object in the buffer. Users will not usually need to call this directly. The `FlatBuffers` compiler will generate helper methods that call this method internally.For example, using the "Monster" code found on the "landing page". An object of type `Monster` can be created using the following code:
int testArrayOfString = Monster.createTestarrayofstringVector(fbb, new int[] { fbb.createString("test1"), fbb.createString("test2") }); Monster.startMonster(fbb); Monster.addPos(fbb, Vec3.createVec3(fbb, 1.0f, 2.0f, 3.0f, 3.0, Color.Green, (short)5, (byte)6)); Monster.addHp(fbb, (short)80); Monster.addName(fbb, str); Monster.addInventory(fbb, inv); Monster.addTestType(fbb, (byte)Any.Monster); Monster.addTest(fbb, mon2); Monster.addTest4(fbb, test4); Monster.addTestarrayofstring(fbb, testArrayOfString); int mon = Monster.endMonster(fbb);Here:
- The call to `Monster#startMonster(FlatBufferBuilder)` will call this method with the right number of fields set.
 - `Monster#endMonster(FlatBufferBuilder)` will ensure 
endObject()is called. 
It's not recommended to call this method directly. If it's called manually, you must ensure to audit all calls to it whenever fields are added or removed from your schema. This is automatically done by the code generated by the `FlatBuffers` compiler.
- Parameters:
 numfields- The number of fields found in this object.
 
- 
addBoolean
public void addBoolean(int o, boolean x, boolean d)Add a `boolean` to a table at `o` into its vtable, with value `x` and default `d`.- Parameters:
 o- The index into the vtable.x- A `boolean` to put into the buffer, depending on how defaults are handled. If `force_defaults` is `false`, compare `x` against the default value `d`. If `x` contains the default value, it can be skipped.d- A `boolean` default value to compare against when `force_defaults` is `false`.
 
- 
addByte
public void addByte(int o, byte x, int d)Add a `byte` to a table at `o` into its vtable, with value `x` and default `d`.- Parameters:
 o- The index into the vtable.x- A `byte` to put into the buffer, depending on how defaults are handled. If `force_defaults` is `false`, compare `x` against the default value `d`. If `x` contains the default value, it can be skipped.d- A `byte` default value to compare against when `force_defaults` is `false`.
 
- 
addShort
public void addShort(int o, short x, int d)Add a `short` to a table at `o` into its vtable, with value `x` and default `d`.- Parameters:
 o- The index into the vtable.x- A `short` to put into the buffer, depending on how defaults are handled. If `force_defaults` is `false`, compare `x` against the default value `d`. If `x` contains the default value, it can be skipped.d- A `short` default value to compare against when `force_defaults` is `false`.
 
- 
addInt
public void addInt(int o, int x, int d)Add an `int` to a table at `o` into its vtable, with value `x` and default `d`.- Parameters:
 o- The index into the vtable.x- An `int` to put into the buffer, depending on how defaults are handled. If `force_defaults` is `false`, compare `x` against the default value `d`. If `x` contains the default value, it can be skipped.d- An `int` default value to compare against when `force_defaults` is `false`.
 
- 
addLong
public void addLong(int o, long x, long d)Add a `long` to a table at `o` into its vtable, with value `x` and default `d`.- Parameters:
 o- The index into the vtable.x- A `long` to put into the buffer, depending on how defaults are handled. If `force_defaults` is `false`, compare `x` against the default value `d`. If `x` contains the default value, it can be skipped.d- A `long` default value to compare against when `force_defaults` is `false`.
 
- 
addFloat
public void addFloat(int o, float x, double d)Add a `float` to a table at `o` into its vtable, with value `x` and default `d`.- Parameters:
 o- The index into the vtable.x- A `float` to put into the buffer, depending on how defaults are handled. If `force_defaults` is `false`, compare `x` against the default value `d`. If `x` contains the default value, it can be skipped.d- A `float` default value to compare against when `force_defaults` is `false`.
 
- 
addDouble
public void addDouble(int o, double x, double d)Add a `double` to a table at `o` into its vtable, with value `x` and default `d`.- Parameters:
 o- The index into the vtable.x- A `double` to put into the buffer, depending on how defaults are handled. If `force_defaults` is `false`, compare `x` against the default value `d`. If `x` contains the default value, it can be skipped.d- A `double` default value to compare against when `force_defaults` is `false`.
 
- 
addOffset
public void addOffset(int o, int x, int d)Add an `offset` to a table at `o` into its vtable, with value `x` and default `d`.- Parameters:
 o- The index into the vtable.x- An `offset` to put into the buffer, depending on how defaults are handled. If `force_defaults` is `false`, compare `x` against the default value `d`. If `x` contains the default value, it can be skipped.d- An `offset` default value to compare against when `force_defaults` is `false`.
 
- 
addStruct
public void addStruct(int voffset, int x, int d)Add a struct to the table. Structs are stored inline, so nothing additional is being added.- Parameters:
 voffset- The index into the vtable.x- The offset of the created struct.d- The default value is always `0`.
 
- 
slot
public void slot(int voffset)
Set the current vtable at `voffset` to the current location in the buffer.- Parameters:
 voffset- The index into the vtable to store the offset relative to the end of the buffer.
 
- 
endObject
public int endObject()
Finish off writing the object that is under construction.- Returns:
 - The offset to the object inside 
dataBuffer(). - See Also:
 startObject(int)
 
- 
required
public void required(int table, int field)Checks that a required field has been set in a given table that has just been constructed.- Parameters:
 table- The offset to the start of the table from the `ByteBuffer` capacity.field- The offset to the field in the vtable.
 
- 
finish
public void finish(int root_table)
Finalize a buffer, pointing to the given `root_table`.- Parameters:
 root_table- An offset to be added to the buffer.
 
- 
finishSizePrefixed
public void finishSizePrefixed(int root_table)
Finalize a buffer, pointing to the given `root_table`, with the size prefixed.- Parameters:
 root_table- An offset to be added to the buffer.
 
- 
finish
public void finish(int root_table, java.lang.String file_identifier)Finalize a buffer, pointing to the given `root_table`.- Parameters:
 root_table- An offset to be added to the buffer.file_identifier- A FlatBuffer file identifier to be added to the buffer before `root_table`.
 
- 
finishSizePrefixed
public void finishSizePrefixed(int root_table, java.lang.String file_identifier)Finalize a buffer, pointing to the given `root_table`, with the size prefixed.- Parameters:
 root_table- An offset to be added to the buffer.file_identifier- A FlatBuffer file identifier to be added to the buffer before `root_table`.
 
- 
forceDefaults
public FlatBufferBuilder forceDefaults(boolean forceDefaults)
In order to save space, fields that are set to their default value don't get serialized into the buffer. Forcing defaults provides a way to manually disable this optimization.- Parameters:
 forceDefaults- When set to `true`, always serializes default values.- Returns:
 - Returns `this`.
 
 
- 
dataBuffer
public java.nio.ByteBuffer dataBuffer()
Get the ByteBuffer representing the FlatBuffer. Only call this after you've called `finish()`. The actual data starts at the ByteBuffer's current position, not necessarily at `0`.- Returns:
 - The 
ByteBufferrepresenting the FlatBuffer 
 
- 
sizedByteArray
public byte[] sizedByteArray(int start, int length)A utility function to copy and return the ByteBuffer data from `start` to `start` + `length` as a `byte[]`.- Parameters:
 start- Start copying at this offset.length- How many bytes to copy.- Returns:
 - A range copy of the 
data buffer. - Throws:
 java.lang.IndexOutOfBoundsException- If the range of bytes is ouf of bound.
 
- 
sizedByteArray
public byte[] sizedByteArray()
A utility function to copy and return the ByteBuffer data as a `byte[]`.- Returns:
 - A full copy of the 
data buffer. 
 
- 
sizedInputStream
public java.io.InputStream sizedInputStream()
A utility function to return an InputStream to the ByteBuffer data- Returns:
 - An InputStream that starts at the beginning of the ByteBuffer data and can read to the end of it.
 
 
 - 
 
 -