Package io.objectbox.flatbuffers
Interface ReadBuf
-
- All Known Subinterfaces:
ReadWriteBuf
- All Known Implementing Classes:
ArrayReadWriteBuf
,ByteBufferReadWriteBuf
public interface ReadBuf
Represent a chunk of data, where FlexBuffers will read from.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description byte[]
data()
Expose ReadBuf as an array of bytes.byte
get(int index)
Read a byte from data.boolean
getBoolean(int index)
Read boolean from data.double
getDouble(int index)
Read a 64-bit float from data.float
getFloat(int index)
Read a 32-bit float from data.int
getInt(int index)
Read a 32-bit int from data.long
getLong(int index)
Read a 64-bit long from data.short
getShort(int index)
Read a short from data.java.lang.String
getString(int start, int size)
Read an UTF-8 string from data.int
limit()
Defines the size of the message in the buffer.
-
-
-
Method Detail
-
getBoolean
boolean getBoolean(int index)
Read boolean from data. Booleans as stored as single byte- Parameters:
index
- position of the element in ReadBuf- Returns:
- boolean element
-
get
byte get(int index)
Read a byte from data.- Parameters:
index
- position of the element in ReadBuf- Returns:
- a byte
-
getShort
short getShort(int index)
Read a short from data.- Parameters:
index
- position of the element in ReadBuf- Returns:
- a short
-
getInt
int getInt(int index)
Read a 32-bit int from data.- Parameters:
index
- position of the element in ReadBuf- Returns:
- an int
-
getLong
long getLong(int index)
Read a 64-bit long from data.- Parameters:
index
- position of the element in ReadBuf- Returns:
- a long
-
getFloat
float getFloat(int index)
Read a 32-bit float from data.- Parameters:
index
- position of the element in ReadBuf- Returns:
- a float
-
getDouble
double getDouble(int index)
Read a 64-bit float from data.- Parameters:
index
- position of the element in ReadBuf- Returns:
- a double
-
getString
java.lang.String getString(int start, int size)
Read an UTF-8 string from data.- Parameters:
start
- initial element of the stringsize
- size of the string in bytes.- Returns:
- a
String
-
data
byte[] data()
Expose ReadBuf as an array of bytes. This method is meant to be as efficient as possible, so for a array-backed ReadBuf, it should return its own internal data. In case access to internal data is not possible, a copy of the data into an array of bytes might occur.- Returns:
- ReadBuf as an array of bytes
-
limit
int limit()
Defines the size of the message in the buffer. It also determines last position that buffer can be read. Last byte to be accessed is in positionlimit() -1
.- Returns:
- indicate last position
-
-