Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
flatbuffers
Commits
6dff7c68
Commit
6dff7c68
authored
Jun 27, 2016
by
Wouter van Oortmerssen
Committed by
GitHub
Jun 27, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3916 from YuryBandarchuk16/master
Added new constants
parents
2fdafa9a
ec59dc02
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
14 deletions
+22
-14
Constants.java
java/com/google/flatbuffers/Constants.java
+8
-0
FlatBufferBuilder.java
java/com/google/flatbuffers/FlatBufferBuilder.java
+14
-14
No files found.
java/com/google/flatbuffers/Constants.java
View file @
6dff7c68
...
...
@@ -23,10 +23,18 @@ package com.google.flatbuffers;
*/
public
class
Constants
{
// Java doesn't seem to have these.
/** The number of bytes in an `byte`. */
static
final
int
SIZEOF_BYTE
=
1
;
/** The number of bytes in a `short`. */
static
final
int
SIZEOF_SHORT
=
2
;
/** The number of bytes in an `int`. */
static
final
int
SIZEOF_INT
=
4
;
/** The number of bytes in an `float`. */
static
final
int
SIZEOF_FLOAT
=
4
;
/** The number of bytes in an `long`. */
static
final
int
SIZEOF_LONG
=
8
;
/** The number of bytes in an `double`. */
static
final
int
SIZEOF_DOUBLE
=
8
;
/** The number of bytes in a file identifier. */
static
final
int
FILE_IDENTIFIER_LENGTH
=
4
;
}
...
...
java/com/google/flatbuffers/FlatBufferBuilder.java
View file @
6dff7c68
...
...
@@ -188,7 +188,7 @@ public class FlatBufferBuilder {
*
* @param x A `boolean` to put into the buffer.
*/
public
void
putBoolean
(
boolean
x
)
{
bb
.
put
(
space
-=
1
,
(
byte
)(
x
?
1
:
0
));
}
public
void
putBoolean
(
boolean
x
)
{
bb
.
put
(
space
-=
Constants
.
SIZEOF_BYTE
,
(
byte
)(
x
?
1
:
0
));
}
/**
* Add a `byte` to the buffer, backwards from the current location. Doesn't align nor
...
...
@@ -196,7 +196,7 @@ public class FlatBufferBuilder {
*
* @param x A `byte` to put into the buffer.
*/
public
void
putByte
(
byte
x
)
{
bb
.
put
(
space
-=
1
,
x
);
}
public
void
putByte
(
byte
x
)
{
bb
.
put
(
space
-=
Constants
.
SIZEOF_BYTE
,
x
);
}
/**
* Add a `short` to the buffer, backwards from the current location. Doesn't align nor
...
...
@@ -204,7 +204,7 @@ public class FlatBufferBuilder {
*
* @param x A `short` to put into the buffer.
*/
public
void
putShort
(
short
x
)
{
bb
.
putShort
(
space
-=
2
,
x
);
}
public
void
putShort
(
short
x
)
{
bb
.
putShort
(
space
-=
Constants
.
SIZEOF_SHORT
,
x
);
}
/**
* Add an `int` to the buffer, backwards from the current location. Doesn't align nor
...
...
@@ -212,7 +212,7 @@ public class FlatBufferBuilder {
*
* @param x An `int` to put into the buffer.
*/
public
void
putInt
(
int
x
)
{
bb
.
putInt
(
space
-=
4
,
x
);
}
public
void
putInt
(
int
x
)
{
bb
.
putInt
(
space
-=
Constants
.
SIZEOF_INT
,
x
);
}
/**
* Add a `long` to the buffer, backwards from the current location. Doesn't align nor
...
...
@@ -220,7 +220,7 @@ public class FlatBufferBuilder {
*
* @param x A `long` to put into the buffer.
*/
public
void
putLong
(
long
x
)
{
bb
.
putLong
(
space
-=
8
,
x
);
}
public
void
putLong
(
long
x
)
{
bb
.
putLong
(
space
-=
Constants
.
SIZEOF_LONG
,
x
);
}
/**
* Add a `float` to the buffer, backwards from the current location. Doesn't align nor
...
...
@@ -228,7 +228,7 @@ public class FlatBufferBuilder {
*
* @param x A `float` to put into the buffer.
*/
public
void
putFloat
(
float
x
)
{
bb
.
putFloat
(
space
-=
4
,
x
);
}
public
void
putFloat
(
float
x
)
{
bb
.
putFloat
(
space
-=
Constants
.
SIZEOF_FLOAT
,
x
);
}
/**
* Add a `double` to the buffer, backwards from the current location. Doesn't align nor
...
...
@@ -236,7 +236,7 @@ public class FlatBufferBuilder {
*
* @param x A `double` to put into the buffer.
*/
public
void
putDouble
(
double
x
)
{
bb
.
putDouble
(
space
-=
8
,
x
);
}
public
void
putDouble
(
double
x
)
{
bb
.
putDouble
(
space
-=
Constants
.
SIZEOF_DOUBLE
,
x
);
}
/// @endcond
/**
...
...
@@ -244,49 +244,49 @@ public class FlatBufferBuilder {
*
* @param x A `boolean` to put into the buffer.
*/
public
void
addBoolean
(
boolean
x
)
{
prep
(
1
,
0
);
putBoolean
(
x
);
}
public
void
addBoolean
(
boolean
x
)
{
prep
(
Constants
.
SIZEOF_BYTE
,
0
);
putBoolean
(
x
);
}
/**
* Add a `byte` to the buffer, properly aligned, and grows the buffer (if necessary).
*
* @param x A `byte` to put into the buffer.
*/
public
void
addByte
(
byte
x
)
{
prep
(
1
,
0
);
putByte
(
x
);
}
public
void
addByte
(
byte
x
)
{
prep
(
Constants
.
SIZEOF_BYTE
,
0
);
putByte
(
x
);
}
/**
* Add a `short` to the buffer, properly aligned, and grows the buffer (if necessary).
*
* @param x A `short` to put into the buffer.
*/
public
void
addShort
(
short
x
)
{
prep
(
2
,
0
);
putShort
(
x
);
}
public
void
addShort
(
short
x
)
{
prep
(
Constants
.
SIZEOF_SHORT
,
0
);
putShort
(
x
);
}
/**
* Add an `int` to the buffer, properly aligned, and grows the buffer (if necessary).
*
* @param x An `int` to put into the buffer.
*/
public
void
addInt
(
int
x
)
{
prep
(
4
,
0
);
putInt
(
x
);
}
public
void
addInt
(
int
x
)
{
prep
(
Constants
.
SIZEOF_INT
,
0
);
putInt
(
x
);
}
/**
* Add a `long` to the buffer, properly aligned, and grows the buffer (if necessary).
*
* @param x A `long` to put into the buffer.
*/
public
void
addLong
(
long
x
)
{
prep
(
8
,
0
);
putLong
(
x
);
}
public
void
addLong
(
long
x
)
{
prep
(
Constants
.
SIZEOF_LONG
,
0
);
putLong
(
x
);
}
/**
* Add a `float` to the buffer, properly aligned, and grows the buffer (if necessary).
*
* @param x A `float` to put into the buffer.
*/
public
void
addFloat
(
float
x
)
{
prep
(
4
,
0
);
putFloat
(
x
);
}
public
void
addFloat
(
float
x
)
{
prep
(
Constants
.
SIZEOF_FLOAT
,
0
);
putFloat
(
x
);
}
/**
* Add a `double` to the buffer, properly aligned, and grows the buffer (if necessary).
*
* @param x A `double` to put into the buffer.
*/
public
void
addDouble
(
double
x
)
{
prep
(
8
,
0
);
putDouble
(
x
);
}
public
void
addDouble
(
double
x
)
{
prep
(
Constants
.
SIZEOF_DOUBLE
,
0
);
putDouble
(
x
);
}
/**
* Adds on offset, relative to where it will be written.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment