aboutsummaryrefslogtreecommitdiff
path: root/java/README.txt
diff options
context:
space:
mode:
authorMax Cai <maxtroy@google.com>2014-01-15 18:47:56 +0000
committerMax Cai <maxtroy@google.com>2014-01-16 12:41:15 +0000
commite005be6554108ab24ed0059b15c459a6c6e9b66c (patch)
tree8424d1b3be745eb5562b7e637d75d2f927e6c1d2 /java/README.txt
parenta793c09b6fd88fa7910beeadc6d26f8106c43c3f (diff)
downloadprotobuf-e005be6554108ab24ed0059b15c459a6c6e9b66c.tar.gz
protobuf-e005be6554108ab24ed0059b15c459a6c6e9b66c.tar.bz2
protobuf-e005be6554108ab24ed0059b15c459a6c6e9b66c.zip
Add validation when parsing enum fields.
Invalid values from the wire are silently ignored. Unlike full/lite, the invalid values are not stored into the unknown fields, because there's no way to get them out from Nano's unknown fields without a matching Extension. Edited README and slightly moved it towards a standalone section for Nano, independent of the Micro section. Change-Id: I2c1eb07f4d6d8f3aea242b8ddd95b9c966f3f177
Diffstat (limited to 'java/README.txt')
-rw-r--r--java/README.txt38
1 files changed, 19 insertions, 19 deletions
diff --git a/java/README.txt b/java/README.txt
index 0646c232..13865f6d 100644
--- a/java/README.txt
+++ b/java/README.txt
@@ -409,33 +409,33 @@ still generated as integer constants in the message class.
Nano version
============================
-Nano is even smaller than micro, especially in the number of generated
-functions. It is like micro:
-
-- No support for descriptors and reflection;
-- Enum constants are integers with no protection against invalid
- values set to enum fields.
-
-Except:
-
-- Setter/getter/hazzer/clearer functions are opt-in.
+Nano is a special code generator and runtime library designed specially
+for Android, and is very resource-friendly in both the amount of code
+and the runtime overhead. An overview of Nano features:
+
+- No descriptors or message builders.
+- All messages are mutable; fields are public Java fields.
+- For optional fields only, encapsulation behind setter/getter/hazzer/
+ clearer functions is opt-in, which provide proper 'has' state support.
- If not opted in, has state is not available. Serialization outputs
- all fields not equal to their default. (See important implications
- below.)
+ all fields not equal to their defaults (see important implications
+ below).
+- Required fields are always serialized.
+- Enum constants are integers; protection against invalid values only
+ when parsing from the wire.
- Enum constants can be generated into container interfaces bearing
the enum's name (so the referencing code is in Java style).
-- CodedInputStreamMicro is renamed to CodedInputByteBufferNano and can
- only take byte[] (not InputStream).
-- Similar rename from CodedOutputStreamMicro to
- CodedOutputByteBufferNano.
-- Repeated fields are in arrays, not ArrayList or Vector.
+- CodedInputByteBufferNano can only take byte[] (not InputStream).
+- Similarly CodedOutputByteBufferNano can only write to byte[].
+- Repeated fields are in arrays, not ArrayList or Vector. Null array
+ elements are allowed and silently ignored.
- Full support of serializing/deserializing repeated packed fields.
+- Support of extensions.
- Unset messages/groups are null, not an immutable empty default
instance.
-- Required fields are always serialized.
- toByteArray(...) and mergeFrom(...) are now static functions of
MessageNano.
-- "bytes" are of java type byte[].
+- The 'bytes' type translates to the Java type byte[].
IMPORTANT: If you have fields with defaults and opt out of accessors