Class RleCompression
-
- All Implemented Interfaces:
public class RleCompression
Run-length encoding (RLE) management class. Format of the bytes in the RLE encoded output buffer: bit 7: polarity (0/1) bit 6-0: consecutive occurence of this bit (can hold up to 127 repetition) Ex: byte 0x87 means 0x07 repetition of bit 1 ==> equivalent uncompressed data is 1111111 Ex: byte 0x4E means 0x4E (78) repetition of bit 0 ==> equivalent uncompressed data is 000...0000 (78 bits) Ex: byte 0xFF means 0x7F (127) repetition of bit 1 ==> equivalent uncompressed data is 111...1111 (127 bits)
Ex: input (not encoded): F0 FF 00 AB 0A FF FF F0 00 00 output (RLE encoded): 84 04 88 08 81 01 81 01 81 01 82 04 81 01 81 01 94 14
-
-
Constructor Summary
Constructors Constructor Description RleCompression()
-
Method Summary
-
-
Method Detail
-
decode
static Array<byte> decode(Array<byte> rleBuffer)
Perform RLE decode on the RLE buffer
- Parameters:
rleBuffer
- RLE buffer to decode.- Returns:
the decoded buffer. Ex: F0 FF 00 AB 0A FF FF F0 00 00
-
encode
@NonNull() static Array<byte> encode(Array<byte> buffer)
Perform RLE encoding on buffer
- Parameters:
buffer
- buffer not encoded.- Returns:
the RLE encoded buffer. Ex: 84 04 88 08 81 01 81 01 81 01 82 04 81 01 81 01 94 14
-
isEncodingUsefull
static boolean isEncodingUsefull(Array<byte> buffer)
Indicate if RLE encoding might be usefull
- Parameters:
buffer
- to check- Returns:
true if RLE encoding might be usefull
-
-
-
-