public class AnsCompression
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static void |
countFrequencies(int[] freq,
byte[] data)
Count the frequencies of codes in the data, and increment the target
frequency table.
|
static byte[] |
decode(int[] freq,
byte[] data,
int length)
Decode the data.
|
static byte[] |
encode(int[] freq,
byte[] data)
Encode the data.
|
static void |
scaleFrequencies(int[] freq,
int total)
Scale the frequencies to a new total.
|
public static void countFrequencies(int[] freq,
byte[] data)
freq - the target frequency tabledata - the datapublic static void scaleFrequencies(int[] freq,
int total)
freq - the (source and target) frequency tabletotal - the target total (sum of all frequencies)public static byte[] encode(int[] freq,
byte[] data)
freq - the frequency table (will be scaled)data - the source data (uncompressed)public static byte[] decode(int[] freq,
byte[] data,
int length)
freq - the frequency table (will be scaled)data - the compressed datalength - the target length