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
c95ad9cc
Commit
c95ad9cc
authored
Jan 10, 2015
by
Patrick Julien
Committed by
Wouter van Oortmerssen
Jan 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reuse the same charset instance
Change-Id: I58b411a2c0f1ee6b856d5b1eaa42787036da1384
parent
35508999
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
Table.java
java/com/google/flatbuffers/Table.java
+2
-3
No files found.
java/com/google/flatbuffers/Table.java
View file @
c95ad9cc
...
...
@@ -18,7 +18,6 @@ package com.google.flatbuffers;
import
static
com
.
google
.
flatbuffers
.
Constants
.*;
import
java.nio.ByteBuffer
;
import
java.nio.charset.Charset
;
// All tables in the generated code derive from this class, and add their own accessors.
public
class
Table
{
...
...
@@ -45,7 +44,7 @@ public class Table {
protected
String
__string
(
int
offset
)
{
offset
+=
bb
.
getInt
(
offset
);
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
{
// We can't access .array(), since the ByteBuffer is read-only.
// We're forced to make an extra copy:
...
...
@@ -54,7 +53,7 @@ public class Table {
bb
.
position
(
offset
+
SIZEOF_INT
);
bb
.
get
(
copy
);
bb
.
position
(
old_pos
);
return
new
String
(
copy
,
0
,
copy
.
length
,
Charset
.
forName
(
"UTF-8"
)
);
return
new
String
(
copy
,
0
,
copy
.
length
,
FlatBufferBuilder
.
utf8charset
);
}
}
...
...
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