Class ScreenCompression


  • public class ScreenCompression
    extends java.lang.Object
    A simple screen compression using RLE algorithm.
    Author:
    Christopher Mindus
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      byte[]packBytes​(byte[] in, int start, int length)
      Function to pack an array of bytes with RLE sentinel bytes 0xFD (8-bit) and 0xFF (16-bit), 0xFE [byte] if the [byte] is 0xFD, 0xFE or 0xFF.
      char[]packChars​(char[] in, int start, int length)
      Function to pack an array of characters with RLE sentinel bytes 0x7F (8-bit) and 0xFF (16-bit), 0xFE [char] if the [char] is 0x7F, 0xFE or 0xFF.
      byte[]unpackBytes​(byte[] in)
      Function to unpack an array of bytes with RLE sentinel bytes 0xFE (8-bit) and 0xFF (16-bit), 0xFD [byte] if the [byte] is 0xFD, 0xFE or 0xFF.
      char[]unpackChars​(char[] in)
      Function to unpack an array of characters with RLE sentinel bytes 0x7F (8-bit) and 0xFF (16-bit), 0xFE [char] if the [char] is 0x7F, 0xFF or 0xFE.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ScreenCompression

        public ScreenCompression()
    • Method Detail

      • packChars

        public char[] packChars​(char[] in,
                                int start,
                                int length)
        Function to pack an array of characters with RLE sentinel bytes 0x7F (8-bit) and 0xFF (16-bit), 0xFE [char] if the [char] is 0x7F, 0xFE or 0xFF.
        Parameters:
        in - The input array.
        start - The starting position.
        length - The length of the data.
        Returns:
        The output array, RLE packed.
      • unpackChars

        public char[] unpackChars​(char[] in)
        Function to unpack an array of characters with RLE sentinel bytes 0x7F (8-bit) and 0xFF (16-bit), 0xFE [char] if the [char] is 0x7F, 0xFF or 0xFE.
        Parameters:
        in - The input array.
        Returns:
        The output array, RLE packed.
      • packBytes

        public byte[] packBytes​(byte[] in,
                                int start,
                                int length)
        Function to pack an array of bytes with RLE sentinel bytes 0xFD (8-bit) and 0xFF (16-bit), 0xFE [byte] if the [byte] is 0xFD, 0xFE or 0xFF.
        Parameters:
        in - The input array.
        start - The starting position.
        length - The length of the data.
        Returns:
        The output array, RLE packed.
      • unpackBytes

        public byte[] unpackBytes​(byte[] in)
        Function to unpack an array of bytes with RLE sentinel bytes 0xFE (8-bit) and 0xFF (16-bit), 0xFD [byte] if the [byte] is 0xFD, 0xFE or 0xFF.
        Parameters:
        in - The input array.
        Returns:
        The output array, RLE packed.