download
dydoc
dynam
lua
nanoki
pl
support
zoe

PL — The Implementation

PL provides a free and open source implementation to demonstrate the usage of its format and types. The implementation is in the Java programming language. Source and binary download available.

The implementation can be used at 3 levels:

reading a property list

import alt.dev.pl.PLReader;

new PLReader( anInputStream ).readObject();

writing a property list

import alt.dev.pl.PLWriter;

new PLWriter( anOutputStream ).writeObject( anObject );

properties

import alt.dev.pl.PL;

PL someProperties = new PL();

someProperties.load( anInputStream );

someProperties.store( anOutputStream );

serializing an object to PL

import alt.dev.pl.PLObjectOutput;

PLObjectOutput.toString( anObject );

// Alternatively

new PLObjectOutput( anOutputStream ).writeObject( anObject );

deserializing an object back from PL

import alt.dev.pl.PLObjectInput;

PLObjectInput.valueOf( aString );

// Alternatively

new PLObjectInput( anInputStream ).readObject();

custom serialization

To overwrite the default serialization mechanism, you can register your own PLObjectInputReader and PLObjectOutputWriter.

PLObjectOutputWriter.registerWriter( aWriter );

PLObjectInputReader.registerReader( aReader );

Here is an example of a custom java.lang.StringBuffer reader and writer.

custom types

The Java implementation provides several custom types tailored for object serialization.

x-bigdecimal

A x-bigdecimal is enclosed in double quotation marks and prefixed with the literal x-bigdecimal:. For example:

"x-bigdecimal:8.539734222673565966488240519"

Valid x-bigdecimal values are the one returned by java.math.BigDecimal.

x-biginteger

A x-biginteger is enclosed in double quotation marks and prefixed with the literal x-biginteger:. For example:

"x-biginteger:88004293940654845815221765739"

Valid x-biginteger values are the one returned by java.math.BigInteger.

x-class

A x-class is enclosed in double quotation marks and prefixed with the literal x-class:. For example:

"x-class:java.lang.Runnable"

Valid x-class values are language specific. In Java, they reflect the value returned by java.lang.Class.

x-field

A x-field is a Map structure. For example:

{

":" = "x-field"; "name" = "serialVersionUID"; "class" = "x-class:java.util.HashMap"; "type" = "x-class:long"; }

Valid x-field values are language specific. In Java, they reflect the information provided by java.lang.reflect.Field.

x-method

A x-method is a Map structure. For example:

{

":" = "x-method"; "name" = "put"; "class" = "x-class:java.util.HashMap"; "types" = ( "x-class:java.lang.Object", "x-class:java.lang.Object" ); "return" = "x-class:java.lang.Object"; }

Valid x-method values are language specific. In Java, they reflect the information provided by java.lang.reflect.Method and java.lang.reflect.Constructor.

x-proxy

A x-proxy is a Map structure. For example:

{

":" = "x-proxy"; "handler" = { ":" = "x-object"; "class" = "x-class:PLTestTool"; "values" = ""; }; "interfaces" = ( "x-class:java.lang.Comparable", "x-class:java.util.Iterator", "x-class:java.lang.Runnable" ); }

Valid x-proxy values are language specific. In Java, they reflect the information provided by java.lang.reflect.Proxy.

x-object

A x-object is a Map structure. For example:

{

":" = "x-object"; "class" = "x-class:java.util.BitSet"; "values" = { "bits" = ( "long:0" ); }; }

Valid x-object values are language specific. In Java, they reflect the information provided by java.lang.reflect.

x-java-serialized-object

A x-java-serialized-object is a Map structure. For example:

{

":" = "x-java-serialized-object"; "class" = "x-class:java.util.Date"; "value" = <ACED00057>; }

Valid x-java-serialized-object values are specific to java.io.ObjectOutputStream.

* * *


name Remember
email
http://
Message
  Textile Help