CodecLZOP

Documentation for CodecLZOP.

CodecLZOP.LZOPCompressorType
LZOPCompressor([algo=LZO1X_1]; <keyword arguments>) <: TranscodingStreams.Codec

Compress data using the LZOP method.

Arguments

  • algo: LibLZO.AbstractLZOAlgorithm, Type{LibLZO.AbstractLZOAlgorithm}, Symbol, or AbstractString describing the LZO algorithm to use when compressing the data.

Keyword Arguments

  • block_size::Integer = LZOP_DEFAULT_BLOCK_SIZE: the maximum size of each block into which the input data will be split before compressing with LZO. Cannot be greater than 64 * 2^20 (64 MB).
  • uncompressed_checksum::Union{Symbol, Nothing} = :adler32: can be any of the following values:
    • :adler32: write an Adler32 checksum of the uncompressed data (default).
    • :crc32: write a CRC32 checksum of the uncompressed data.
    • nothing: do not write a checksum of the uncompressed data.
  • compressed_checksum::Union{Symbol, Nothing} = nothing: can be any of the following values:
    • :adler32: write an Adler32 checksum of the compressed data.
    • :crc32: write a CRC32 checksum of the compressed data.
    • nothing: do not write a checksum of the compressed data (default).
  • filter::Function = identity: a function applied to the compressed data as it is streamed. The function must take a single AbstractVector{UInt8} argument and modify it in place without changing its size.
  • optimize::Bool = false: whether to run the LZO optimization function on compressed data before writing it to the stream. Optimization doubles the compression time and rarely results in improved compression ratios, so it is disabled by default.
source
CodecLZOP.LZOPCompressorStreamType
LZOPCompressorStream(io, [algo=LZO1X_1]; <keyword arguments>) <: TranscodingStreams.TranscodingStream

Compress stream using the LZOP method.

Arguments

  • io::IO: stream to compress.
  • algo: LibLZO.AbstractLZOAlgorithm, Type{LibLZO.AbstractLZOAlgorithm}, Symbol, or AbstractString describing the LZO algorithm to use when compressing the data.

Keyword Arguments

  • block_size::Integer = LZOP_DEFAULT_BLOCK_SIZE: the maximum size of each block into which the input data will be split before compressing with LZO. Cannot be greater than 64 * 2^20 (64 MB).
  • uncompressed_checksum::Union{Symbol, Nothing} = :adler32: can be any of the following values:
    • :adler32: write an Adler32 checksum of the uncompressed data (default).
    • :crc32: write a CRC32 checksum of the uncompressed data.
    • nothing: do not write a checksum of the uncompressed data.
  • compressed_checksum::Union{Symbol, Nothing} = nothing: can be any of the following values:
    • :adler32: write an Adler32 checksum of the compressed data.
    • :crc32: write a CRC32 checksum of the compressed data.
    • nothing: do not write a checksum of the compressed data (default).
  • filter::Function = identity: a function applied to the compressed data as it is streamed. The function must take a single AbstractVector{UInt8} argument and modify it in place without changing its size.
  • optimize::Bool = false: whether to run the LZO optimization function on compressed data before writing it to the stream. Optimization doubles the compression time and rarely results in improved compression ratios, so it is disabled by default.

All other keyword arguments are passed unmodified to the TranscodingStream constructor.

source
CodecLZOP.LZOPDecompressorType
LZOPDecompressor([algo=LZO1X_1]; <keyword arguments>) <: TranscodingStreams.Codec

Dexompress data using the LZOP method.

Arguments

  • algo: LibLZO.AbstractLZOAlgorithm, Type{LibLZO.AbstractLZOAlgorithm}, Symbol, or AbstractString describing the LZO algorithm to use when decompressing the data. The decompression algorithm must match the algorithm used to compress the data.

Keyword Arguments

  • uncompressed_checksum::Union{Symbol, Nothing} = :adler32: can be any of the following values:
    • :adler32: expect and decode an Adler32 checksum of the uncompressed data (default).
    • :crc32: expect and decode a CRC32 checksum of the uncompressed data.
    • nothing: expect no checksum of the uncompressed data.
  • compressed_checksum::Union{Symbol, Nothing} = nothing: can be any of the following values:
    • :adler32: expect and decode an Adler32 checksum of the compressed data.
    • :crc32: expect and decode a CRC32 checksum of the compressed data.
    • nothing: expect no checksum of the compressed data (default).
  • filter::Function = identity: a function applied to the decompressed data as it is streamed. The function must take a single AbstractVector{UInt8} argument and modify it in place without changing its size.
  • on_checksum_fail::Symbol = :throw: a flag to determine how checksum failures are handled. :throw will cause an ErrorException to be thrown, :warn will log a warning using the @warn macro, and :ignore will silently ignore the failure.
source
CodecLZOP.LZOPDecompressorStreamType
LZOPDecompressorStream(io, [algo=LZO1X_1]; <keyword arguments>) <: TranscodingStreams.TranscodingStream

Dexompress data using the LZOP method.

Arguments

  • io::IO: stream to decompress.
  • algo: LibLZO.AbstractLZOAlgorithm, Type{LibLZO.AbstractLZOAlgorithm}, Symbol, or AbstractString describing the LZO algorithm to use when decompressing the data. The decompression algorithm must match the algorithm used to compress the data.

Keyword Arguments

  • uncompressed_checksum::Union{Symbol, Nothing} = :adler32: can be any of the following values:
    • :adler32: expect and decode an Adler32 checksum of the uncompressed data (default).
    • :crc32: expect and decode a CRC32 checksum of the uncompressed data.
    • nothing: expect no checksum of the uncompressed data.
  • compressed_checksum::Union{Symbol, Nothing} = nothing: can be any of the following values:
    • :adler32: expect and decode an Adler32 checksum of the compressed data.
    • :crc32: expect and decode a CRC32 checksum of the compressed data.
    • nothing: expect no checksum of the compressed data (default).
  • filter::Function = identity: a function applied to the decompressed data as it is streamed. The function must take a single AbstractVector{UInt8} argument and modify it in place without changing its size.
  • on_checksum_fail::Symbol = :throw: a flag to determine how checksum failures are handled. :throw will cause an ErrorException to be thrown, :warn will log a warning using the @warn macro, and :ignore will silently ignore the failure.

All other keyword arguments are passed unmodified to the TranscodingStream constructor.

source
CodecLZOP.compress_blockMethod
compress_block(input, output, algo; [kwargs...])::Tuple{Int,Int}

Compress a block of data from input to output using LZO algorithm algo, returning the number of bytes read from input and written to output.

Arguments

  • input: An AbstractVector{UInt8} or IO object containing the block of data to compress.
  • output::IO: Output IO object to write the compressed block.

Keyword arguments

  • block_size::Integer = LZOP_DEFAULT_BLOCK_SIZE: Number of bytes to read from input. Will cap at LZOP_MAX_BLOCK_SIZE.
  • uncompressed_checksum::Union{Symbol, Nothing} = :adler32: can be any of the following values:
    • :adler32: write an Adler32 checksum of the uncompressed data (default).
    • :crc32: write a CRC32 checksum of the uncompressed data.
    • nothing: do not write a checksum of the uncompressed data.
  • compressed_checksum::Union{Symbol, Nothing} = nothing: can be any of the following values:
    • :adler32: write an Adler32 checksum of the compressed data.
    • :crc32: write a CRC32 checksum of the compressed data.
    • nothing: do not write a checksum of the compressed data (default).
  • filter_function::Function = identity: Transform the input data using the specified filter functions. The filter function must accept a single AbstractVector{UInt8} argument and must modify that vector in-place.
  • optimize::Bool = false: If true, process the data twice to optimize how it is stored for faster decompression. Setting this to true doubles compression time with little to no improvement in decompression time, so its use is not recommended.
source
CodecLZOP.decompress_blockMethod
decompress_block(input, output, algo; [kwargs...])::Tuple{Int,Int}

Decompress a block of data from input to output using LZO algorithm algo, returning the number of bytes read from input and written to output.

Arguments

  • input: An AbstractVector{UInt8} or IO object containing the block of LZO-compressed data to decompress.
  • output::IO: Output IO object to write the decompressed block.

Keyword arguments

  • uncompressed_checksum::Union{Symbol, Nothing} = :adler32: can be any of the following values:
    • :adler32: expect and decode an Adler32 checksum of the uncompressed data (default).
    • :crc32: expect and decode a CRC32 checksum of the uncompressed data.
    • nothing: expect no checksum of the uncompressed data.
  • compressed_checksum::Union{Symbol, Nothing} = nothing: can be any of the following values:
    • :adler32: expect and decode an Adler32 checksum of the compressed data.
    • :crc32: expect and decode a CRC32 checksum of the compressed data.
    • nothing: expect no checksum of the compressed data (default).
  • filter_function::Function = identity: Untransform the output data using the specified filter function. The filter function must take a single AbstractVector{UInt8} argument and modify it in place.
  • on_checksum_fail::Symbol = :throw: Choose how the function responds to invalud checksums. If :throw, an ErrorException will be thrown. If :warn, a warning will be printed. If :ignore, the checksum values will be completely ignored.
source