r9653 - helma-ng/trunk/modules/helma
[email protected] Wed, 22 Apr 2009 15:09:58 +0200 (CEST)
| Newsgroups | gmane.comp.java.helma.cvs |
|---|---|
| Message-ID | <20090422130958.453A63D0D6@mia> |
Author: hannes
Date: 2009-04-22 15:09:58 +0200 (Wed, 22 Apr 2009)
New Revision: 9653
Modified:
helma-ng/trunk/modules/helma/system.js
Log:
Add jsdoc comments to serialize() and deserialize().
Details at http://dev.helma.org/trac/helma/changeset/9653
Modified: helma-ng/trunk/modules/helma/system.js
===================================================================
--- helma-ng/trunk/modules/helma/system.js 2009-04-22 13:09:56 UTC (rev 9652)
+++ helma-ng/trunk/modules/helma/system.js 2009-04-22 13:09:58 UTC (rev 9653)
@@ -80,6 +80,13 @@
getRhinoEngine().setOptimizationLevel(level);
}
+/**
+ * Serialize a JavaScript object graph to a java.io.OutputStream. If the
+ * function is called without second argument the serialized object is
+ * returned as byte array.
+ * @param object the object to serialize
+ * @param output a java.io.OutputStream
+ */
function serialize(object, output) {
if (!(output instanceof java.io.OutputStream)) {
output = new java.io.ByteArrayOutputStream();
@@ -89,6 +96,11 @@
getRhinoEngine().serialize(object, output);
}
+/**
+ * Deserialize a previously serialized object graph from a java.io.Inputstream
+ * or a byte array.
+ * @param input a InputStream or byte array containing a serialized object
+ */
function deserialize(input) {
if (!(input instanceof java.io.InputStream)) {
input = new java.io.ByteArrayInputStream(input);