ref_send API 2.17
defensive programming in Java

org.waterken.syntax.json
Class JSONSerializer

java.lang.Object
  extended by org.joe_e.Struct
      extended by org.waterken.syntax.json.JSONSerializer
All Implemented Interfaces:
java.io.Serializable, Immutable, Powerless, Selfless, Record, Serializer

public final class JSONSerializer
extends Struct
implements Serializer, Record, java.io.Serializable

Serializes an array of Java objects to a JSON byte stream.

See Also:
Serialized Form

Constructor Summary
JSONSerializer()
           
 
Method Summary
 ByteArray serialize(Exporter export, java.lang.reflect.Type type, java.lang.Object value)
          Serializes an object.
 ByteArray serializeTuple(Exporter export, ConstArray<java.lang.reflect.Type> types, ConstArray<?> values)
          Serializes a tuple.
static void write(Exporter export, java.lang.reflect.Type type, java.lang.Object value, java.io.Writer text)
          Serializes a stream of Java objects to a JSON text stream.
 
Methods inherited from class org.joe_e.Struct
equals, hashCode
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.joe_e.Selfless
hashCode
 

Constructor Detail

JSONSerializer

public JSONSerializer()
Method Detail

serialize

public ByteArray serialize(Exporter export,
                           java.lang.reflect.Type type,
                           java.lang.Object value)
                    throws java.lang.Exception
Description copied from interface: Serializer
Serializes an object.

Specified by:
serialize in interface Serializer
Parameters:
export - reference exporter
type - implict type for value
value - value to serialize
Returns:
serialized content
Throws:
java.lang.Exception

serializeTuple

public ByteArray serializeTuple(Exporter export,
                                ConstArray<java.lang.reflect.Type> types,
                                ConstArray<?> values)
                         throws java.lang.Exception
Description copied from interface: Serializer
Serializes a tuple.

Specified by:
serializeTuple in interface Serializer
Parameters:
export - reference exporter
types - each implict type for values
values - values to serialize
Returns:
serialized content
Throws:
java.lang.Exception

write

public static void write(Exporter export,
                         java.lang.reflect.Type type,
                         java.lang.Object value,
                         java.io.Writer text)
                  throws java.lang.Exception
Serializes a stream of Java objects to a JSON text stream.

Parameters:
export - reference exporter
type - implicit type for value
value - value to serialize
text - UTF-8 text output, will be flushed and closed
Throws:
java.lang.Exception

ref_send API 2.17
defensive programming in Java

Submit a bug or feature, or get help

Copyright 1998-2009 Waterken Inc. under the terms of the MIT X license.