Loading…

Kryptel/Java

IMemoryBlockCompressor interface

Declaration

package com.kryptel.compressor;

public interface IMemoryBlockCompressor {
  byte[] CompressBlock(final byte[] src, int start, int size) throws Exception;
  byte[] DecompressBlock(final byte[] src, int start, int size) throws Exception;

  byte[] CompressUtf8String(final String str) throws Exception;
  String DecompressUtf8String(final byte[] src, int start, int size) throws Exception;

  byte[] CompressWideString(final String str) throws Exception;
  String DecompressWideString(final byte[] src, int start, int size) throws Exception;
}

Description

This interface compresses or decompresses small data blocks in memory and strings (UTF-8 or UTF-16 ones).

CompressBlock

byte[] CompressBlock(final byte[] src, int start, int size) throws Exception;

Compresses size bytes of data in src at position start and returns the compressed block as a byte array.

DecompressBlock

byte[] DecompressBlock(final byte[] src, int start, int size) throws Exception;

Decomresses the block compressed with the CompressBlock function. The size of the block must be exactly the size of the array returned by CompressBlock; a wrong size value will cause an exception.

CompressUtf8String

byte[] CompressUtf8String(final String str) throws Exception;

Converts the argument string to UTF-8, compresses it, and

DecompressUtf8String

String DecompressUtf8String(final byte[] src, int start, int size) throws Exception;

Decompresses the block of data to a UTF-8 string, and returns it as a Java string.

CompressWideString

byte[] CompressWideString(final String str) throws Exception;

Compresses a UTF-16 string and returns the compressed string as a byte array.

DecompressWideString

String DecompressWideString(final byte[] src, int start, int size) throws Exception;

Decompresses the block of data to a UTF-16 string, and returns it.