Interface Decompressor

All Known Implementing Classes:
GBADiffUnfilterer, GBAHuffmanDecompressor, GBALZSSDecompressor, GBALZXDecompressor, GBARLDecompressor

public interface Decompressor
Decompresses data from a Cartridge.

Unless otherwise noted, implementations are thread-safe.

  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    decompress​(Cartridge cartridge)
    Decompresses data starting at the current offset of the given cartridge.
    default byte[]
    decompress​(Cartridge cartridge, long offset)
    Decompresses data starting at the given offset from the given cartridge.
  • Method Details

    • decompress

      default byte[] decompress(Cartridge cartridge, long offset) throws DecompressionException
      Decompresses data starting at the given offset from the given cartridge. The offset of the cartridge is not modified.
      Parameters:
      cartridge - the cartridge
      offset - the offset where compressed data starts
      Returns:
      the decompressed data
      Throws:
      DecompressionException - if an error occurs while attempting decompression
      IllegalArgumentException - if the given offset is out of bounds, i.e. less than 0 or greater than or equal to {@code cartridge.size()}
    • decompress

      byte[] decompress(Cartridge cartridge) throws DecompressionException
      Decompresses data starting at the current offset of the given cartridge. The offset of the cartridge is incremented by the number of bytes read.
      Parameters:
      cartridge - the cartridge
      Returns:
      the decompressed data
      Throws:
      DecompressionException - if an error occurs while attempting decompression