mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-30 14:10:03 +00:00
Merge branch 'master' of https://github.com/google/flatbuffers
This commit is contained in:
8
java/com/google/flatbuffers/FlatBufferBuilder.java
Normal file → Executable file
8
java/com/google/flatbuffers/FlatBufferBuilder.java
Normal file → Executable file
@@ -28,8 +28,7 @@ import java.nio.charset.Charset;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class that helps you build a FlatBuffer. See the section
|
* Class that helps you build a FlatBuffer. See the section
|
||||||
* @ref flatbuffers_guide_use_java_c-sharp "Use in Java/C#" in the
|
* "Use in Java/C#" in the main FlatBuffers documentation.
|
||||||
* main FlatBuffers documentation.
|
|
||||||
*/
|
*/
|
||||||
public class FlatBufferBuilder {
|
public class FlatBufferBuilder {
|
||||||
/// @cond FLATBUFFERS_INTERNAL
|
/// @cond FLATBUFFERS_INTERNAL
|
||||||
@@ -428,8 +427,7 @@ public class FlatBufferBuilder {
|
|||||||
* call this directly. The `FlatBuffers` compiler will generate helper methods
|
* call this directly. The `FlatBuffers` compiler will generate helper methods
|
||||||
* that call this method internally.
|
* that call this method internally.
|
||||||
* <p>
|
* <p>
|
||||||
* For example, using the "Monster" code found on the
|
* For example, using the "Monster" code found on the "landing page". An
|
||||||
* @ref flatbuffers_guide_use_java_c-sharp "landing page". An
|
|
||||||
* object of type `Monster` can be created using the following code:
|
* object of type `Monster` can be created using the following code:
|
||||||
*
|
*
|
||||||
* <pre>{@code
|
* <pre>{@code
|
||||||
@@ -708,6 +706,8 @@ public class FlatBufferBuilder {
|
|||||||
* Get the ByteBuffer representing the FlatBuffer. Only call this after you've
|
* Get the ByteBuffer representing the FlatBuffer. Only call this after you've
|
||||||
* called `finish()`. The actual data starts at the ByteBuffer's current position,
|
* called `finish()`. The actual data starts at the ByteBuffer's current position,
|
||||||
* not necessarily at `0`.
|
* not necessarily at `0`.
|
||||||
|
*
|
||||||
|
* @return The {@link ByteBuffer} representing the FlatBuffer
|
||||||
*/
|
*/
|
||||||
public ByteBuffer dataBuffer() {
|
public ByteBuffer dataBuffer() {
|
||||||
finished();
|
finished();
|
||||||
|
|||||||
@@ -113,9 +113,13 @@ public class Table {
|
|||||||
/**
|
/**
|
||||||
* Get a whole vector as a ByteBuffer.
|
* Get a whole vector as a ByteBuffer.
|
||||||
*
|
*
|
||||||
* This is efficient, since it only allocates a new bytebuffer object, but does not actually copy
|
* This is efficient, since it only allocates a new {@link ByteBuffer} object,
|
||||||
* the data, it still refers to the same bytes as the original ByteBuffer. Also useful with nested
|
* but does not actually copy the data, it still refers to the same bytes
|
||||||
* FlatBuffers, etc.
|
* as the original ByteBuffer. Also useful with nested FlatBuffers, etc.
|
||||||
|
*
|
||||||
|
* @param vector_offset The position of the vector in the byte buffer
|
||||||
|
* @param elem_size The size of each element in the array
|
||||||
|
* @return The {@link ByteBuffer} for the array
|
||||||
*/
|
*/
|
||||||
protected ByteBuffer __vector_as_bytebuffer(int vector_offset, int elem_size) {
|
protected ByteBuffer __vector_as_bytebuffer(int vector_offset, int elem_size) {
|
||||||
int o = __offset(vector_offset);
|
int o = __offset(vector_offset);
|
||||||
@@ -142,10 +146,12 @@ public class Table {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a ByteBuffer contains a file identifier.
|
* Check if a {@link ByteBuffer} contains a file identifier.
|
||||||
*
|
*
|
||||||
* @param bb A `ByteBuffer` to check if it contains the identifier `ident`.
|
* @param bb A {@code ByteBuffer} to check if it contains the identifier
|
||||||
* @param ident A `String` identifier of the flatbuffer file.
|
* `ident`.
|
||||||
|
* @param ident A `String` identifier of the FlatBuffer file.
|
||||||
|
* @return True if the buffer contains the file identifier
|
||||||
*/
|
*/
|
||||||
protected static boolean __has_identifier(ByteBuffer bb, String ident) {
|
protected static boolean __has_identifier(ByteBuffer bb, String ident) {
|
||||||
if (ident.length() != FILE_IDENTIFIER_LENGTH)
|
if (ident.length() != FILE_IDENTIFIER_LENGTH)
|
||||||
|
|||||||
Reference in New Issue
Block a user