Package org.eclipse.ditto.json
Interface SerializationContext
- All Superinterfaces:
AutoCloseable
,Closeable
,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
Modifier and TypeMethodDescriptionvoid
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
(String name) Writes the passed stringname
(as field name) to the serialization context.void
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
(String text) Writes the passed stringtext
to the serialization context.
-
Method Details
-
writeCachedElement
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:
IOException
-
writeNull
Writesnull
to the serialization context.- Throws:
IOException
-
writeBoolean
Writes the passed booleanstate
to the serialization context.- Throws:
IOException
-
writeNumber
Writes the passed floatnumber
to the serialization context.- Throws:
IOException
-
writeNumber
Writes the passed doublenumber
to the serialization context.- Throws:
IOException
-
writeNumber
Writes the passed longnumber
to the serialization context.- Throws:
IOException
-
writeNumber
Writes the passed longnumber
to the serialization context.- Throws:
IOException
-
writeString
Writes the passed stringtext
to the serialization context.- Throws:
IOException
-
writeFieldName
Writes the passed stringname
(as field name) to the serialization context.- Throws:
IOException
-