Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1389)

Unified Diff: mojo/public/tools/bindings/generators/java_templates/data_types_definition.tmpl

Issue 2327103004: Mojo Java Bindings: expose public API for struct serialization. (Closed)
Patch Set: . Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/java/bindings/src/org/chromium/mojo/bindings/Struct.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/tools/bindings/generators/java_templates/data_types_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/java_templates/data_types_definition.tmpl b/mojo/public/tools/bindings/generators/java_templates/data_types_definition.tmpl
index 39d2e6fa777686bf5fabc2624f4c5dbd73fcd6fb..aa3f6f6d9d27ea637fea86d78e4af7141ca0ab66 100644
--- a/mojo/public/tools/bindings/generators/java_templates/data_types_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/java_templates/data_types_definition.tmpl
@@ -182,6 +182,19 @@ if ({{variable}} != null) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
+ /**
+ * Similar to the method above, but deserializes from a |ByteBuffer| instance.
+ *
+ * @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
+ */
+ public static {{struct|name}} deserialize(java.nio.ByteBuffer data) {
+ if (data == null)
+ return null;
+
+ return deserialize(new org.chromium.mojo.bindings.Message(
+ data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
+ }
+
@SuppressWarnings("unchecked")
public static {{struct|name}} decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
« no previous file with comments | « mojo/public/java/bindings/src/org/chromium/mojo/bindings/Struct.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698