Package totalcross.json.zip
Class Zipper
- java.lang.Object
-
- totalcross.json.zip.JSONzip
-
- totalcross.json.zip.Zipper
-
- All Implemented Interfaces:
None,PostMortem
public class Zipper extends JSONzip
An encoder implements the compression behavior of JSONzip. It provides a zip method that takes a JSONObject or JSONArray and delivers a stream of bits to a BitWriter. FOR EVALUATION PURPOSES ONLY. THIS PACKAGE HAS NOT BEEN TESTED ADEQUATELY FOR PRODUCTION USE.
-
-
Field Summary
-
Fields inherited from class totalcross.json.zip.JSONzip
bcd, end, endOfNumber, int14, int4, int7, namehuff, namehuffext, namekeep, probe, stringhuff, stringhuffext, stringkeep, valuekeep, zipArrayString, zipArrayValue, zipEmptyArray, zipEmptyObject, zipFalse, zipNull, zipObject, zipTrue
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidencode(JSONArray jsonarray)Encode a JSONArray.voidencode(JSONObject jsonobject)Encode a JSONObject.voidflush()Finish the final byte and flush the bitwriter.voidpad(int width)Pad the output to fill an allotment of bits.-
Methods inherited from class totalcross.json.zip.JSONzip
generate, postMortem
-
-
-
-
Constructor Detail
-
Zipper
public Zipper(BitWriter bitwriter)
Create a new encoder. It may be used for an entire session or subsession.- Parameters:
bitwriter- The BitWriter this encoder will output to. Don't forget to flush.
-
-
Method Detail
-
flush
public void flush() throws JSONExceptionFinish the final byte and flush the bitwriter. This does the same thing as pad(8).- Throws:
JSONException
-
pad
public void pad(int width) throws JSONExceptionPad the output to fill an allotment of bits.- Parameters:
width- The size of the bit allotment. A value of 8 will complete and flush the current byte. If you don't pad, then some of the last bits might not be sent to the Output Stream.- Throws:
JSONException
-
encode
public void encode(JSONObject jsonobject) throws JSONException
Encode a JSONObject.- Parameters:
jsonobject- The JSONObject.- Throws:
JSONException
-
encode
public void encode(JSONArray jsonarray) throws JSONException
Encode a JSONArray.- Parameters:
jsonarray- The JSONArray.- Throws:
JSONException
-
-