@Beta public class GridCompression extends java.lang.Object
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
Constructor and Description |
---|
GridCompression() |
Modifier and Type | Method and 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 java.lang.String |
compress(byte[][] grid) |
static java.lang.String |
compress(double[][] grid) |
static byte[][] |
decompress(java.lang.String compressed) |
static byte[] |
doubleGridToByteArray(double[][] doubles) |
static byte[][] |
doubleToByteGrid(double[][] doubles) |
static byte[][] |
doubleToByteGrid(double[][] doubles,
byte[][] bytes) |
public static java.lang.String compress(double[][] grid)
public static java.lang.String compress(byte[][] grid)
public static byte[][] decompress(java.lang.String compressed)
public static double[][] byteToDoubleGrid(byte[][] bytes)
public static double[][] byteToDoubleGrid(byte[][] bytes, double[][] doubles)
public static byte[][] doubleToByteGrid(double[][] doubles)
public static byte[][] doubleToByteGrid(double[][] doubles, byte[][] bytes)
public static byte[] doubleGridToByteArray(double[][] doubles)
public static double[][] byteArrayToDoubleGrid(byte[] bytes)
public static byte[] byteGridToByteArray(byte[][] grid)
public static byte[][] byteArrayToByteGrid(byte[] bytes)
Copyright © Eben Howard 2012–2022. All rights reserved.