Class DocumentIndexSerializer
java.lang.Object
com.codename1.documents.DocumentIndexSerializer
Converts a published document tree to and from the index.json the platform readers consume.
The format is deliberately small and forward-compatible: absent keys mean "unknown", which is
what lets a reader written against one version of the schema survive a newer publisher. v
carries the schema version so a future reader can tell a missing key from a renamed one.
The reader half exists for the simulator and for tests. On device the parsing is done natively -- Swift in the Apple extension, Java in the Android provider -- because the app process is not running when the browser asks.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe schema version written into every index. -
Method Summary
Modifier and TypeMethodDescriptionstatic DocumentNodedeserialize(String json) Parses an index produced byserialize.static Stringserialize(DocumentNode root) Serializes a document tree.
-
Field Details
-
VERSION
public static final int VERSIONThe schema version written into every index.- See Also:
-
-
Method Details
-
serialize
Serializes a document tree.
Parameters
root: the root node, must not be null
Returns
the index JSON
-
deserialize
Parses an index produced by
serialize.Parameters
json: the index JSON
Returns
the root node
Throws
IOException: when the text is not readable as an index
- Throws:
IOException
-