Package squidpony
Class GridCompression
java.lang.Object
squidpony.GridCompression
@Beta public class GridCompression extends Object
Very early way of additional compression that can be applied to 2D double and byte arrays. This doesn't compress a
well as using
This class is marked Beta because it still has some improvement that can be done on it, like having more support for other array types.
Created by Tommy Ettinger on 4/27/2020.
LZSEncoding
on a simply-serialized String produced by Converters.convertArrayDouble2D
,
but you can use LZSEncoding on the results of this class to significantly reduce output size. Testing on a heat map
of byte values from -128 to 127 from a world map:
Base size : 1143142 // this is an uncompressed String produced by Converters LZS size : 89170 // this uses LZSEncoding alone on the above Base string Custom size : 216209 // this uses GridCompression alone Both size : 43120 // this uses GridCompression followed by LZSEncoding
This class is marked Beta because it still has some improvement that can be done on it, like having more support for other array types.
Created by Tommy Ettinger on 4/27/2020.
-
Constructor Summary
Constructors Constructor Description GridCompression()
-
Method Summary
Modifier and Type Method Description static byte[][]
byteArrayToByteGrid(byte[] bytes)
static double[][]
byteArrayToDoubleGrid(byte[] bytes)
static byte[]
byteGridToByteArray(byte[][] grid)
static double[][]
byteToDoubleGrid(byte[][] bytes)
static double[][]
byteToDoubleGrid(byte[][] bytes, double[][] doubles)
static String
compress(byte[][] grid)
static String
compress(double[][] grid)
static byte[][]
decompress(String compressed)
static byte[]
doubleGridToByteArray(double[][] doubles)
static byte[][]
doubleToByteGrid(double[][] doubles)
static byte[][]
doubleToByteGrid(double[][] doubles, byte[][] bytes)
-
Constructor Details
-
GridCompression
public GridCompression()
-
-
Method Details