Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
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
protobuf
Commits
0f2a7d3f
Commit
0f2a7d3f
authored
Feb 03, 2015
by
Jisi Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add readData(int) to read primitive value.
parent
60bccb60
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
CodedInputByteBufferNano.java
...va/com/google/protobuf/nano/CodedInputByteBufferNano.java
+40
-0
No files found.
javanano/src/main/java/com/google/protobuf/nano/CodedInputByteBufferNano.java
View file @
0f2a7d3f
...
...
@@ -638,4 +638,44 @@ public final class CodedInputByteBufferNano {
throw
InvalidProtocolBufferNanoException
.
truncatedMessage
();
}
}
// Read a primitive type.
Object
readData
(
int
type
)
throws
IOException
{
switch
(
type
)
{
case
InternalNano
.
TYPE_DOUBLE
:
return
readDouble
();
case
InternalNano
.
TYPE_FLOAT
:
return
readFloat
();
case
InternalNano
.
TYPE_INT64
:
return
readInt64
();
case
InternalNano
.
TYPE_UINT64
:
return
readUInt64
();
case
InternalNano
.
TYPE_INT32
:
return
readInt32
();
case
InternalNano
.
TYPE_FIXED64
:
return
readFixed64
();
case
InternalNano
.
TYPE_FIXED32
:
return
readFixed32
();
case
InternalNano
.
TYPE_BOOL
:
return
readBool
();
case
InternalNano
.
TYPE_STRING
:
return
readString
();
case
InternalNano
.
TYPE_BYTES
:
return
readBytes
();
case
InternalNano
.
TYPE_UINT32
:
return
readUInt32
();
case
InternalNano
.
TYPE_ENUM
:
return
readEnum
();
case
InternalNano
.
TYPE_SFIXED32
:
return
readSFixed32
();
case
InternalNano
.
TYPE_SFIXED64
:
return
readSFixed64
();
case
InternalNano
.
TYPE_SINT32
:
return
readSInt32
();
case
InternalNano
.
TYPE_SINT64
:
return
readSInt64
();
default
:
throw
new
IllegalArgumentException
(
"Unknown type "
+
type
);
}
}
}
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