Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fuchsia.googlesource.com-third_party-flatbuffers
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fuchsia-mirror
fuchsia.googlesource.com-third_party-flatbuffers
Commits
c95ad9cc
Commit
c95ad9cc
authored
10 years ago
by
Patrick Julien
Committed by
Wouter van Oortmerssen
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Reuse the same charset instance
Change-Id: I58b411a2c0f1ee6b856d5b1eaa42787036da1384
parent
35508999
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/com/google/flatbuffers/Table.java
+2
-3
2 additions, 3 deletions
java/com/google/flatbuffers/Table.java
with
2 additions
and
3 deletions
java/com/google/flatbuffers/Table.java
+
2
−
3
View file @
c95ad9cc
...
@@ -18,7 +18,6 @@ package com.google.flatbuffers;
...
@@ -18,7 +18,6 @@ package com.google.flatbuffers;
import
static
com
.
google
.
flatbuffers
.
Constants
.*;
import
static
com
.
google
.
flatbuffers
.
Constants
.*;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
import
java.nio.charset.Charset
;
// All tables in the generated code derive from this class, and add their own accessors.
// All tables in the generated code derive from this class, and add their own accessors.
public
class
Table
{
public
class
Table
{
...
@@ -45,7 +44,7 @@ public class Table {
...
@@ -45,7 +44,7 @@ public class Table {
protected
String
__string
(
int
offset
)
{
protected
String
__string
(
int
offset
)
{
offset
+=
bb
.
getInt
(
offset
);
offset
+=
bb
.
getInt
(
offset
);
if
(
bb
.
hasArray
())
{
if
(
bb
.
hasArray
())
{
return
new
String
(
bb
.
array
(),
offset
+
SIZEOF_INT
,
bb
.
getInt
(
offset
),
Charset
.
forName
(
"UTF-8"
)
);
return
new
String
(
bb
.
array
(),
offset
+
SIZEOF_INT
,
bb
.
getInt
(
offset
),
FlatBufferBuilder
.
utf8charset
);
}
else
{
}
else
{
// We can't access .array(), since the ByteBuffer is read-only.
// We can't access .array(), since the ByteBuffer is read-only.
// We're forced to make an extra copy:
// We're forced to make an extra copy:
...
@@ -54,7 +53,7 @@ public class Table {
...
@@ -54,7 +53,7 @@ public class Table {
bb
.
position
(
offset
+
SIZEOF_INT
);
bb
.
position
(
offset
+
SIZEOF_INT
);
bb
.
get
(
copy
);
bb
.
get
(
copy
);
bb
.
position
(
old_pos
);
bb
.
position
(
old_pos
);
return
new
String
(
copy
,
0
,
copy
.
length
,
Charset
.
forName
(
"UTF-8"
)
);
return
new
String
(
copy
,
0
,
copy
.
length
,
FlatBufferBuilder
.
utf8charset
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment