Package com.yahoo.slime
Class JsonFormat
java.lang.Object
com.yahoo.slime.JsonFormat
- All Implemented Interfaces:
SlimeFormat
Encodes json from a slime object.
- Author:
- Ulf Lilleengen
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
encode
(AbstractByteWriter os, Inspector value) void
encode
(AbstractByteWriter os, Slime slime) void
encode
(OutputStream os, Inspector value) void
encode
(OutputStream os, Slime slime) Encode a slime object into the provided output streamstatic Slime
jsonToSlime
(byte[] json) Returns the given UTF-8-encoded JSON as a Slime objectstatic byte[]
toJsonBytes
(Slime slime) Returns the given slime data as UTF-8-encoded JSON
-
Constructor Details
-
JsonFormat
public JsonFormat(int indent) -
JsonFormat
public JsonFormat(boolean compact)
-
-
Method Details
-
encode
Description copied from interface:SlimeFormat
Encode a slime object into the provided output stream- Specified by:
encode
in interfaceSlimeFormat
- Parameters:
os
- The outputstream to write to.slime
- The slime object to encode.- Throws:
IOException
-
encode
- Throws:
IOException
-
encode
- Throws:
IOException
-
encode
- Throws:
IOException
-
toJsonBytes
Returns the given slime data as UTF-8-encoded JSON -
jsonToSlime
Returns the given UTF-8-encoded JSON as a Slime object
-