Class 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.
    • 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 JSONException
        Finish the final byte and flush the bitwriter. This does the same thing as pad(8).
        Throws:
        JSONException
      • pad

        public void pad​(int width)
                 throws JSONException
        Pad 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