Package org.eclipse.ditto.json
Interface SerializationContext
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
,java.io.Flushable
public interface SerializationContext extends java.io.Closeable, java.io.Flushable
Bundles state and configuration for serialization. Must be recreated for each serialization target.This is a Ditto internal class which is not intended for re-use. It therefore is not treated as API which is held binary compatible to previous versions.
- Since:
- 1.2.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
writeBoolean(boolean state)
Writes the passed booleanstate
to the serialization context.void
writeCachedElement(byte[] cachedData)
Allows the caller to directly embed cached data in the Buffer.void
writeFieldName(java.lang.String name)
Writes the passed stringname
(as field name) to the serialization context.void
writeNull()
Writesnull
to the serialization context.void
writeNumber(double number)
Writes the passed doublenumber
to the serialization context.void
writeNumber(float number)
Writes the passed floatnumber
to the serialization context.void
writeNumber(int number)
Writes the passed longnumber
to the serialization context.void
writeNumber(long number)
Writes the passed longnumber
to the serialization context.void
writeString(java.lang.String text)
Writes the passed stringtext
to the serialization context.
-
-
-
Method Detail
-
writeCachedElement
void writeCachedElement(byte[] cachedData) throws java.io.IOException
Allows the caller to directly embed cached data in the Buffer. This can only be used to write exactly one element.- Parameters:
cachedData
- The data to write in an appropriately sized array.- Throws:
java.io.IOException
-
writeNull
void writeNull() throws java.io.IOException
Writesnull
to the serialization context.- Throws:
java.io.IOException
-
writeBoolean
void writeBoolean(boolean state) throws java.io.IOException
Writes the passed booleanstate
to the serialization context.- Throws:
java.io.IOException
-
writeNumber
void writeNumber(float number) throws java.io.IOException
Writes the passed floatnumber
to the serialization context.- Throws:
java.io.IOException
-
writeNumber
void writeNumber(double number) throws java.io.IOException
Writes the passed doublenumber
to the serialization context.- Throws:
java.io.IOException
-
writeNumber
void writeNumber(long number) throws java.io.IOException
Writes the passed longnumber
to the serialization context.- Throws:
java.io.IOException
-
writeNumber
void writeNumber(int number) throws java.io.IOException
Writes the passed longnumber
to the serialization context.- Throws:
java.io.IOException
-
writeString
void writeString(java.lang.String text) throws java.io.IOException
Writes the passed stringtext
to the serialization context.- Throws:
java.io.IOException
-
writeFieldName
void writeFieldName(java.lang.String name) throws java.io.IOException
Writes the passed stringname
(as field name) to the serialization context.- Throws:
java.io.IOException
-
-