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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidencode(AbstractByteWriter os, Inspector value) voidencode(AbstractByteWriter os, Slime slime) voidencode(OutputStream os, Inspector value) voidencode(OutputStream os, Slime slime) Encode a slime object into the provided output streamstatic SlimejsonToSlime(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:SlimeFormatEncode a slime object into the provided output stream- Specified by:
encodein 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
-