public abstract class Iced<D extends Iced> extends java.lang.Object implements Freezable<D>, java.io.Externalizable
Auto-serializer base-class using a delegator pattern (the faster option is to byte-code gen directly in all Iced classes, but this requires all Iced classes go through a ClassLoader).
Iced is a marker class, and Freezable
is the companion marker
interface. Marked classes have 2-byte integer type associated with them,
and an auto-genned delegate class created to actually do byte-stream and
JSON serialization and deserialization. Byte-stream serialization is
extremely dense (includes various compressions), and typically memory-bandwidth
bound to generate.
During startup time the Weaver creates a parallel set of classes called (classname)$Icer. These provide bytestream and JSON serializers and deserializers which get called by AutoBuffer.write* and AutoBugger.read*.
To debug the automagic serialization code create a transient field in your Iced class called DEBUG_WEAVER. The generated source code will get written to STDOUT:
transient int DEBUG_WEAVER = 1;
Weaver
,
AutoBuffer
,
Serialized FormConstructor and Description |
---|
Iced() |
Modifier and Type | Method and Description |
---|---|
D |
clone()
Clone, without the annoying exception
|
int |
frozenType()
Returns a small dense integer, which is cluster-wide unique per-class.
|
D |
read_impl(AutoBuffer ab)
Implementation of the
Iced serialization protocol, only called by
auto-genned code. |
D |
read(AutoBuffer ab)
Standard "read thyself from the AutoBuffer" call, using the fast Iced protocol.
|
void |
readExternal(java.io.ObjectInput ois) |
D |
readJSON_impl(AutoBuffer ab)
Implementation of the
Iced serialization protocol, only called by
auto-genned code. |
D |
readJSON(AutoBuffer ab)
Standard "read thyself from the AutoBuffer" call, using JSON.
|
java.lang.String |
toJsonString()
Helper for folks that want a JSON String for this object.
|
AutoBuffer |
write_impl(AutoBuffer ab)
Implementation of the
Iced serialization protocol, only called by
auto-genned code. |
AutoBuffer |
write(AutoBuffer ab)
Standard "write thyself into the AutoBuffer" call, using the fast Iced
protocol.
|
void |
writeExternal(java.io.ObjectOutput oos) |
DocGen.HTML |
writeHTML_impl(DocGen.HTML ab)
Implementation of the
Iced serialization protocol, only called by
auto-genned code. |
DocGen.HTML |
writeHTML(DocGen.HTML sb)
Standard "write thyself into the AutoBuffer" call, using HTML.
|
AutoBuffer |
writeJSON_impl(AutoBuffer ab)
Implementation of the
Iced serialization protocol, only called by
auto-genned code. |
AutoBuffer |
writeJSON(AutoBuffer ab)
Standard "write thyself into the AutoBuffer" call, using JSON.
|
public final AutoBuffer write(AutoBuffer ab)
Icer
classes.write
in interface Freezable<D extends Iced>
ab
- AutoBuffer
to write this object to.AutoBuffer
for flow-coding.public final AutoBuffer writeJSON(AutoBuffer ab)
Icer
classes.writeJSON
in interface Freezable<D extends Iced>
ab
- AutoBuffer
to write this object to.AutoBuffer
for flow-coding.public final DocGen.HTML writeHTML(DocGen.HTML sb)
Icer
classes.writeHTML
in interface Freezable<D extends Iced>
sb
- target to serialize this object in HTML formAutoBuffer
for flow-coding.public final D read(AutoBuffer ab)
Icer
classes.read
in interface Freezable<D extends Iced>
ab
- AutoBuffer
to read this object from.AutoBuffer
for flow-coding.public final D readJSON(AutoBuffer ab)
Icer
classes.readJSON
in interface Freezable<D extends Iced>
ab
- AutoBuffer
to read this object from.AutoBuffer
for flow-coding.public final java.lang.String toJsonString()
public final int frozenType()
frozenType
in interface Freezable<D extends Iced>
public final D clone()
public AutoBuffer write_impl(AutoBuffer ab)
Iced
serialization protocol, only called by
auto-genned code. Not intended to be called by user code. Override only
for custom Iced serializers.write_impl
in interface Freezable<D extends Iced>
ab
- AutoBuffer
to write this object to.AutoBuffer
for flow-coding.public D read_impl(AutoBuffer ab)
Iced
serialization protocol, only called by
auto-genned code. Not intended to be called by user code. Override only
for custom Iced serializers.public AutoBuffer writeJSON_impl(AutoBuffer ab)
Iced
serialization protocol, only called by
auto-genned code. Not intended to be called by user code. Override only
for custom Iced serializers.writeJSON_impl
in interface Freezable<D extends Iced>
ab
- AutoBuffer
to write this object to.AutoBuffer
for flow-coding.public D readJSON_impl(AutoBuffer ab)
Iced
serialization protocol, only called by
auto-genned code. Not intended to be called by user code. Override only
for custom Iced serializers.readJSON_impl
in interface Freezable<D extends Iced>
ab
- AutoBuffer
to read this object from.public DocGen.HTML writeHTML_impl(DocGen.HTML ab)
Iced
serialization protocol, only called by
auto-genned code. Not intended to be called by user code. Override only
for custom Iced serializers.writeHTML_impl
in interface Freezable<D extends Iced>
ab
- html to write object to.public void readExternal(java.io.ObjectInput ois) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
public void writeExternal(java.io.ObjectOutput oos) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException