FlatBuffers
An open source project by FPL.
com.google.flatbuffers.ReadWriteBuf Interface Reference

Interface to represent a read-write buffer. More...

Inheritance diagram for com.google.flatbuffers.ReadWriteBuf:
com.google.flatbuffers.ReadBuf com.google.flatbuffers.ArrayReadWriteBuf com.google.flatbuffers.ByteBufferReadWriteBuf

Detailed Description

Interface to represent a read-write buffer.

This interface will be used to access and write FlexBuffers message.

Public Member Functions

void clear ()
 Clears (resets) the buffer so that it can be reused. More...
 
int limit ()
 Defines the size of the message in the buffer. More...
 
void put (byte value)
 Write a byte into the buffer at. More...
 
void put (byte[] value, int start, int length)
 Put an array of bytes into the buffer at. More...
 
void putBoolean (boolean value)
 Put a boolean into the buffer at. More...
 
void putDouble (double value)
 Write a 64-bit float into the buffer at. More...
 
void putFloat (float value)
 Write a 32-bit float into the buffer at. More...
 
void putInt (int value)
 Write a 32-bit into in the buffer at. More...
 
void putLong (long value)
 Write a 64-bit into in the buffer at. More...
 
void putShort (short value)
 Write a 16-bit into in the buffer at. More...
 
boolean requestCapacity (int capacity)
 Request capacity of the buffer. More...
 
void set (int index, byte value)
 Read a byte from data. More...
 
void set (int index, byte[] value, int start, int length)
 Write an array of bytes into the buffer. More...
 
void setBoolean (int index, boolean value)
 Write boolean into a given position on the buffer. More...
 
void setDouble (int index, double value)
 Read a 64-bit float from data. More...
 
void setFloat (int index, float value)
 Read a 32-bit float from data. More...
 
void setInt (int index, int value)
 Read a 32-bit int from data. More...
 
void setLong (int index, long value)
 Read a 64-bit long from data. More...
 
void setShort (int index, short value)
 Read a short from data. More...
 
int writePosition ()
 
- Public Member Functions inherited from com.google.flatbuffers.ReadBuf
byte[] data ()
 Expose ReadBuf as an array of bytes. More...
 
byte get (int index)
 Read a byte from data. More...
 
boolean getBoolean (int index)
 Read boolean from data. More...
 
double getDouble (int index)
 Read a 64-bit float from data. More...
 
float getFloat (int index)
 Read a 32-bit float from data. More...
 
int getInt (int index)
 Read a 32-bit int from data. More...
 
long getLong (int index)
 Read a 64-bit long from data. More...
 
short getShort (int index)
 Read a short from data. More...
 
String getString (int start, int size)
 Read an UTF-8 string from data. More...
 

Member Function Documentation

◆ clear()

void com.google.flatbuffers.ReadWriteBuf.clear ( )

Clears (resets) the buffer so that it can be reused.

Write position will be set to the start.

Implemented in com.google.flatbuffers.ByteBufferReadWriteBuf, and com.google.flatbuffers.ArrayReadWriteBuf.

◆ limit()

int com.google.flatbuffers.ReadWriteBuf.limit ( )

Defines the size of the message in the buffer.

It also determines last position that buffer can be read or write. Last byte to be accessed is in position

limit() -1
int limit()
Defines the size of the message in the buffer.

.

Returns
indicate last position

Implements com.google.flatbuffers.ReadBuf.

Implemented in com.google.flatbuffers.ByteBufferReadWriteBuf, and com.google.flatbuffers.ArrayReadWriteBuf.

◆ put() [1/2]

void com.google.flatbuffers.ReadWriteBuf.put ( byte  value)

Write a byte into the buffer at.

writePosition()

. Write position will be incremented.

Implemented in com.google.flatbuffers.ByteBufferReadWriteBuf, and com.google.flatbuffers.ArrayReadWriteBuf.

◆ put() [2/2]

void com.google.flatbuffers.ReadWriteBuf.put ( byte[]  value,
int  start,
int  length 
)

Put an array of bytes into the buffer at.

writePosition()

. Write position will be incremented.

Parameters
valuethe data to be copied
startinitial position on value to be copied
lengthamount of bytes to be copied

Implemented in com.google.flatbuffers.ByteBufferReadWriteBuf, and com.google.flatbuffers.ArrayReadWriteBuf.

◆ putBoolean()

void com.google.flatbuffers.ReadWriteBuf.putBoolean ( boolean  value)

Put a boolean into the buffer at.

writePosition()

. Booleans as stored as single byte. Write position will be incremented.

Returns
boolean element

Implemented in com.google.flatbuffers.ByteBufferReadWriteBuf, and com.google.flatbuffers.ArrayReadWriteBuf.

◆ putDouble()

void com.google.flatbuffers.ReadWriteBuf.putDouble ( double  value)

Write a 64-bit float into the buffer at.

writePosition()

. Write position will be incremented.

Implemented in com.google.flatbuffers.ByteBufferReadWriteBuf, and com.google.flatbuffers.ArrayReadWriteBuf.

◆ putFloat()

void com.google.flatbuffers.ReadWriteBuf.putFloat ( float  value)

Write a 32-bit float into the buffer at.

writePosition()

. Write position will be incremented.

Implemented in com.google.flatbuffers.ByteBufferReadWriteBuf, and com.google.flatbuffers.ArrayReadWriteBuf.

◆ putInt()

void com.google.flatbuffers.ReadWriteBuf.putInt ( int  value)

Write a 32-bit into in the buffer at.

writePosition()

. Write position will be incremented.

Implemented in com.google.flatbuffers.ByteBufferReadWriteBuf, and com.google.flatbuffers.ArrayReadWriteBuf.

◆ putLong()

void com.google.flatbuffers.ReadWriteBuf.putLong ( long  value)

Write a 64-bit into in the buffer at.

writePosition()

. Write position will be incremented.

Implemented in com.google.flatbuffers.ByteBufferReadWriteBuf, and com.google.flatbuffers.ArrayReadWriteBuf.

◆ putShort()

void com.google.flatbuffers.ReadWriteBuf.putShort ( short  value)

Write a 16-bit into in the buffer at.

writePosition()

. Write position will be incremented.

Implemented in com.google.flatbuffers.ByteBufferReadWriteBuf, and com.google.flatbuffers.ArrayReadWriteBuf.

◆ requestCapacity()

boolean com.google.flatbuffers.ReadWriteBuf.requestCapacity ( int  capacity)

Request capacity of the buffer.

In case buffer is already larger than the requested, this method will just return true. Otherwise It might try to resize the buffer.

Returns
true if buffer is able to offer the requested capacity

Implemented in com.google.flatbuffers.ByteBufferReadWriteBuf, and com.google.flatbuffers.ArrayReadWriteBuf.

◆ set() [1/2]

void com.google.flatbuffers.ReadWriteBuf.set ( int  index,
byte  value 
)

Read a byte from data.

Parameters
indexposition of the element in the buffer
Returns
a byte

Implemented in com.google.flatbuffers.ByteBufferReadWriteBuf, and com.google.flatbuffers.ArrayReadWriteBuf.

◆ set() [2/2]

void com.google.flatbuffers.ReadWriteBuf.set ( int  index,
byte[]  value,
int  start,
int  length 
)

Write an array of bytes into the buffer.

Parameters
indexinitial position of the buffer to be written
valuethe data to be copied
startinitial position on value to be copied
lengthamount of bytes to be copied

Implemented in com.google.flatbuffers.ByteBufferReadWriteBuf, and com.google.flatbuffers.ArrayReadWriteBuf.

◆ setBoolean()

void com.google.flatbuffers.ReadWriteBuf.setBoolean ( int  index,
boolean  value 
)

Write boolean into a given position on the buffer.

Booleans as stored as single byte.

Parameters
indexposition of the element in buffer

Implemented in com.google.flatbuffers.ByteBufferReadWriteBuf, and com.google.flatbuffers.ArrayReadWriteBuf.

◆ setDouble()

void com.google.flatbuffers.ReadWriteBuf.setDouble ( int  index,
double  value 
)

Read a 64-bit float from data.

Parameters
indexposition of the element in ReadBuf
Returns
a double

Implemented in com.google.flatbuffers.ByteBufferReadWriteBuf, and com.google.flatbuffers.ArrayReadWriteBuf.

◆ setFloat()

void com.google.flatbuffers.ReadWriteBuf.setFloat ( int  index,
float  value 
)

Read a 32-bit float from data.

Parameters
indexposition of the element in ReadBuf
Returns
a float

Implemented in com.google.flatbuffers.ByteBufferReadWriteBuf, and com.google.flatbuffers.ArrayReadWriteBuf.

◆ setInt()

void com.google.flatbuffers.ReadWriteBuf.setInt ( int  index,
int  value 
)

Read a 32-bit int from data.

Parameters
indexposition of the element in ReadBuf
Returns
an int

Implemented in com.google.flatbuffers.ByteBufferReadWriteBuf, and com.google.flatbuffers.ArrayReadWriteBuf.

◆ setLong()

void com.google.flatbuffers.ReadWriteBuf.setLong ( int  index,
long  value 
)

Read a 64-bit long from data.

Parameters
indexposition of the element in ReadBuf
Returns
a long

Implemented in com.google.flatbuffers.ByteBufferReadWriteBuf, and com.google.flatbuffers.ArrayReadWriteBuf.

◆ setShort()

void com.google.flatbuffers.ReadWriteBuf.setShort ( int  index,
short  value 
)

Read a short from data.

Parameters
indexposition of the element in ReadBuf
Returns
a short

Implemented in com.google.flatbuffers.ByteBufferReadWriteBuf, and com.google.flatbuffers.ArrayReadWriteBuf.


The documentation for this interface was generated from the following file: