Skip to content

Commit b7a1aee

Browse files
log
1 parent 7ff3fa4 commit b7a1aee

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

zip/Compressor.java

+2-8
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ of this software and associated documentation files (the "Software"), to deal
3838
* JSONzip is a compression scheme for JSON text.
3939
*
4040
* @author JSON.org
41-
* @version 2013-04-18
41+
* @version 2014-04-21
4242
*/
4343

4444
/**
@@ -110,9 +110,6 @@ public void flush() throws JSONException {
110110
* @throws IOException
111111
*/
112112
private void one() throws JSONException {
113-
if (probe) {
114-
log(1);
115-
}
116113
write(1, 1);
117114
}
118115

@@ -351,7 +348,7 @@ private void writeObject(JSONObject jsonobject) throws JSONException {
351348
Iterator keys = jsonobject.keys();
352349
while (keys.hasNext()) {
353350
if (probe) {
354-
log("\n");
351+
log();
355352
}
356353
Object key = keys.next();
357354
if (key instanceof String) {
@@ -545,9 +542,6 @@ private void writeValue(Object value) throws JSONException {
545542
* @throws IOException
546543
*/
547544
private void zero() throws JSONException {
548-
if (probe) {
549-
log(0);
550-
}
551545
write(0, 1);
552546
}
553547

zip/Decompressor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ of this software and associated documentation files (the "Software"), to deal
3535
* JSONzip is a compression scheme for JSON text.
3636
*
3737
* @author JSON.org
38-
* @version 2013-04-18
38+
* @version 2014-04-21
3939
*/
4040

4141
public class Decompressor extends JSONzip {
@@ -221,7 +221,7 @@ private JSONObject readObject() throws JSONException {
221221
JSONObject jsonobject = new JSONObject();
222222
while (true) {
223223
if (probe) {
224-
log("\n");
224+
log();
225225
}
226226
String name = readName();
227227
jsonobject.put(name, !bit() ? readString() : readValue());

zip/JSONzip.java

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.json.zip;
22

3-
43
/*
54
Copyright (c) 2013 JSON.org
65
@@ -27,7 +26,9 @@ of this software and associated documentation files (the "Software"), to deal
2726

2827
/**
2928
* JSONzip is a binary-encoded JSON dialect. It is designed to compress the
30-
* messages in a session. It is adaptive, so with each message seen, it should
29+
* messages in a session in bandwidth constrained applications, such as mobile.
30+
*
31+
* JSONzip is adaptive, so with each message seen, it should
3132
* improve its compression. It minimizes JSON's overhead, reducing punctuation
3233
* to a small number of bits. It uses Huffman encoding to reduce the average
3334
* size of characters. It uses caches (or Keeps) to keep recently seen strings
@@ -43,7 +44,7 @@ of this software and associated documentation files (the "Software"), to deal
4344
* ADEQUATELY FOR PRODUCTION USE.
4445
*
4546
* @author JSON.org
46-
* @version 2013-04-18
47+
* @version 2014-04-21
4748
*/
4849
public abstract class JSONzip implements None, PostMortem {
4950
/**
@@ -230,12 +231,17 @@ static void log(int integer) {
230231

231232
/**
232233
* Write two integers, separated by ':' to the console.
234+
* The second integer is suppressed if it is 1.
233235
*
234236
* @param integer
235237
* @param width
236238
*/
237239
static void log(int integer, int width) {
238-
log(integer + ":" + width + " ");
240+
if (width == 1) {
241+
log(integer);
242+
} else {
243+
log(integer + ":" + width + " ");
244+
}
239245
}
240246

241247
/**

0 commit comments

Comments
 (0)