mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-17 16:00:51 -07:00
log
This commit is contained in:
parent
7ff3fa4e40
commit
b7a1aee4e1
3 changed files with 14 additions and 14 deletions
|
@ -38,7 +38,7 @@ import org.json.Kim;
|
||||||
* JSONzip is a compression scheme for JSON text.
|
* JSONzip is a compression scheme for JSON text.
|
||||||
*
|
*
|
||||||
* @author JSON.org
|
* @author JSON.org
|
||||||
* @version 2013-04-18
|
* @version 2014-04-21
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,9 +110,6 @@ public class Compressor extends JSONzip {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private void one() throws JSONException {
|
private void one() throws JSONException {
|
||||||
if (probe) {
|
|
||||||
log(1);
|
|
||||||
}
|
|
||||||
write(1, 1);
|
write(1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +348,7 @@ public class Compressor extends JSONzip {
|
||||||
Iterator keys = jsonobject.keys();
|
Iterator keys = jsonobject.keys();
|
||||||
while (keys.hasNext()) {
|
while (keys.hasNext()) {
|
||||||
if (probe) {
|
if (probe) {
|
||||||
log("\n");
|
log();
|
||||||
}
|
}
|
||||||
Object key = keys.next();
|
Object key = keys.next();
|
||||||
if (key instanceof String) {
|
if (key instanceof String) {
|
||||||
|
@ -545,9 +542,6 @@ public class Compressor extends JSONzip {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private void zero() throws JSONException {
|
private void zero() throws JSONException {
|
||||||
if (probe) {
|
|
||||||
log(0);
|
|
||||||
}
|
|
||||||
write(0, 1);
|
write(0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.json.Kim;
|
||||||
* JSONzip is a compression scheme for JSON text.
|
* JSONzip is a compression scheme for JSON text.
|
||||||
*
|
*
|
||||||
* @author JSON.org
|
* @author JSON.org
|
||||||
* @version 2013-04-18
|
* @version 2014-04-21
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Decompressor extends JSONzip {
|
public class Decompressor extends JSONzip {
|
||||||
|
@ -221,7 +221,7 @@ public class Decompressor extends JSONzip {
|
||||||
JSONObject jsonobject = new JSONObject();
|
JSONObject jsonobject = new JSONObject();
|
||||||
while (true) {
|
while (true) {
|
||||||
if (probe) {
|
if (probe) {
|
||||||
log("\n");
|
log();
|
||||||
}
|
}
|
||||||
String name = readName();
|
String name = readName();
|
||||||
jsonobject.put(name, !bit() ? readString() : readValue());
|
jsonobject.put(name, !bit() ? readString() : readValue());
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package org.json.zip;
|
package org.json.zip;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2013 JSON.org
|
Copyright (c) 2013 JSON.org
|
||||||
|
|
||||||
|
@ -27,7 +26,9 @@ package org.json.zip;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JSONzip is a binary-encoded JSON dialect. It is designed to compress the
|
* JSONzip is a binary-encoded JSON dialect. It is designed to compress the
|
||||||
* messages in a session. It is adaptive, so with each message seen, it should
|
* messages in a session in bandwidth constrained applications, such as mobile.
|
||||||
|
*
|
||||||
|
* JSONzip is adaptive, so with each message seen, it should
|
||||||
* improve its compression. It minimizes JSON's overhead, reducing punctuation
|
* improve its compression. It minimizes JSON's overhead, reducing punctuation
|
||||||
* to a small number of bits. It uses Huffman encoding to reduce the average
|
* to a small number of bits. It uses Huffman encoding to reduce the average
|
||||||
* size of characters. It uses caches (or Keeps) to keep recently seen strings
|
* size of characters. It uses caches (or Keeps) to keep recently seen strings
|
||||||
|
@ -43,7 +44,7 @@ package org.json.zip;
|
||||||
* ADEQUATELY FOR PRODUCTION USE.
|
* ADEQUATELY FOR PRODUCTION USE.
|
||||||
*
|
*
|
||||||
* @author JSON.org
|
* @author JSON.org
|
||||||
* @version 2013-04-18
|
* @version 2014-04-21
|
||||||
*/
|
*/
|
||||||
public abstract class JSONzip implements None, PostMortem {
|
public abstract class JSONzip implements None, PostMortem {
|
||||||
/**
|
/**
|
||||||
|
@ -230,13 +231,18 @@ public abstract class JSONzip implements None, PostMortem {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write two integers, separated by ':' to the console.
|
* Write two integers, separated by ':' to the console.
|
||||||
|
* The second integer is suppressed if it is 1.
|
||||||
*
|
*
|
||||||
* @param integer
|
* @param integer
|
||||||
* @param width
|
* @param width
|
||||||
*/
|
*/
|
||||||
static void log(int integer, int width) {
|
static void log(int integer, int width) {
|
||||||
|
if (width == 1) {
|
||||||
|
log(integer);
|
||||||
|
} else {
|
||||||
log(integer + ":" + width + " ");
|
log(integer + ":" + width + " ");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a string to the console.
|
* Write a string to the console.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue