Skip to content

Commit 25bc0e5

Browse files
committed
Release 1.4.4.4 !
1 parent 7f508e1 commit 25bc0e5

File tree

4 files changed

+25
-10
lines changed

4 files changed

+25
-10
lines changed

README.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,15 @@ Installation
8888
---
8989

9090
You can get this version (which should be compatible with lz-string 1.4.4)
91-
[using this info on Maven Central](http://search.maven.org/#artifactdetails%7Ccom.github.tommyettinger%7Cblazingchain%7C1.4.4.3%7Cjar).
91+
[using this info on Maven Central](http://search.maven.org/#artifactdetails%7Ccom.github.tommyettinger%7Cblazingchain%7C1.4.4.4%7Cjar).
9292
That page provides dependency info for many build tools including Maven, Gradle, Ivy, SBT, and Lein.
93-
There should be a release on GitHub as well. For GWT, you will need this inherits line:
93+
There should be a release on GitHub as well. If you just want a quick dependency for Gradle, it looks like:
94+
95+
```groovy
96+
implementation "com.github.tommyettinger:blazingchain:1.4.4.4"
97+
```
98+
99+
If you use this with GWT, you will need this inherits line in your .gwt.xml file:
94100

95101
`<inherits name='blazing.chain' />`
96102

@@ -109,3 +115,8 @@ I have no idea what the poem means, but it mixes ASCII and non-ASCII characters
109115
Each has versions in uncompressed form as well as compressed with UTF16, URI Encoding, and Base-64 modes.
110116
The mode corresponding to `compress()` and `uncompress()` is not provided because I don't know how to accurately
111117
write its invalid UTF-16 codepoints to disk.
118+
119+
The `demo/TransmissionDemo/` folder has the sources for the aforementioned demo, but it also has an
120+
LZByteEncoding and LZIntEncoding class. LZByteEncoding is more likely to be useful, and is more up-to-date;
121+
it compresses a String to a byte array and back again. That is probably desirable for networking tasks, but
122+
using it depends on [libGDX](https://libgdx.com/), so it isn't part of the main repo.

demo/TransmissionDemo/core/src/main/java/blazing/chain/demo/LZIntEncoding.java

+10-6
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@
55
import com.badlogic.gdx.utils.ObjectIntMap;
66
import com.badlogic.gdx.utils.ObjectSet;
77

8+
import java.util.ArrayList;
9+
import java.util.HashMap;
10+
import java.util.HashSet;
11+
812
public class LZIntEncoding {
913
public static int[] compressToInts(String uncompressedStr) {
1014
if (uncompressedStr == null) return null;
1115
if (uncompressedStr.isEmpty()) return new int[0];
1216
final int bitsPerChar = 32;
1317
int i, value;
14-
ObjectIntMap<String> context_dictionary = new ObjectIntMap<>();
15-
ObjectSet<String> context_dictionaryToCreate = new ObjectSet<>();
18+
HashMap<String, Integer> context_dictionary = new HashMap<>(256, 0.5f);
19+
HashSet<String> context_dictionaryToCreate = new HashSet<>(256, 0.5f);
1620
String context_c;
1721
String context_wc;
1822
String context_w = "";
@@ -91,7 +95,7 @@ public static int[] compressToInts(String uncompressedStr) {
9195
}
9296
context_dictionaryToCreate.remove(context_w);
9397
} else {
94-
value = context_dictionary.get(context_w, 0);
98+
value = context_dictionary.get(context_w);
9599
for (i = 0; i < context_numBits; i++) {
96100
context_data_val = (context_data_val << 1) | (value & 1);
97101
if (context_data_position == bitsPerChar - 1) {
@@ -170,7 +174,7 @@ public static int[] compressToInts(String uncompressedStr) {
170174

171175
context_dictionaryToCreate.remove(context_w);
172176
} else {
173-
value = context_dictionary.get(context_w, 0);
177+
value = context_dictionary.get(context_w);
174178
for (i = 0; i < context_numBits; i++) {
175179
context_data_val = (context_data_val << 1) | (value & 1);
176180
if (context_data_position == bitsPerChar - 1) {
@@ -218,7 +222,7 @@ public static String decompressFromInts(int[] getNextValue) {
218222
if(length == 0)
219223
return "";
220224
final int resetValue = 0x80000000;
221-
Array<String> dictionary = new Array<>(String.class);
225+
ArrayList<String> dictionary = new ArrayList<>(length >>> 1);
222226
int enlargeIn = 4, dictSize = 4, numBits = 3, position = resetValue, index = 1, resb, maxpower, power;
223227
String entry, w, c;
224228
StringBuilder res = new StringBuilder(length);
@@ -340,7 +344,7 @@ public static String decompressFromInts(int[] getNextValue) {
340344
numBits++;
341345
}
342346

343-
if (cc < dictionary.size && dictionary.get(cc) != null) {
347+
if (cc < dictionary.size() && dictionary.get(cc) != null) {
344348
entry = dictionary.get(cc);
345349
} else {
346350
if (cc == dictSize) {

demo/TransmissionDemo/gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ visUiVersion=1.5.0
55
gwtFrameworkVersion=2.8.2
66
gwtPluginVersion=1.1.12
77
gdxVersion=1.10.0
8-
blazingchainVersion=1.4.4.3
8+
blazingchainVersion=1.4.4.4

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.github.tommyettinger</groupId>
88
<artifactId>blazingchain</artifactId>
9-
<version>1.4.4.4-SNAPSHOT</version>
9+
<version>1.4.4.4</version>
1010
<!-- api "com.github.tommyettinger:blazingchain:1.4.4.3" -->
1111
<description>LZ-String encoding for Java; cross-platform to desktop, GWT, and Android at the minimum.
1212
</description>

0 commit comments

Comments
 (0)