SnappyCodec class final
Snappy compression codec Native Dart implementation based on the Snappy specification
Supports the two formats of SnappyFormat, chosen by format:
- SnappyFormat.raw (default): a single compressed block with a varint-encoded size. Minimal overhead, suitable for small data.
- SnappyFormat.framed: a stream of checksummed chunks, compatible with snzip and other tools. Better for large data.
Note: This is a synchronous codec that operates on complete byte arrays. For stream-based processing, use SnappyStreamCodec instead.
- Inheritance
-
- Object
- CompressionCodec
- SnappyCodec
Constructors
- SnappyCodec({int? maxSize = defaultMaxSize, SnappyFormat format = SnappyFormat.raw, int chunkSize = SnappyStreamEncoder.maxChunkSize})
-
Creates a Snappy codec.
formatselects a raw block (default) or the framing format, whose chunks hold at mostchunkSizebytes of input.maxSizelimits the decompressed output. - SnappyCodec.fromOptions(SnappyOptions options)
-
Creates a Snappy codec from compression options
factory
Properties
- chunkSize → int
-
Chunk size for the framed format (max 65536 per spec)
final
- format → SnappyFormat
-
How the data is packaged: a raw block or the framing format.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxSize → int?
-
Maximum allowed uncompressed size for decompression
final
- name → String
-
The codec's name in upper case: 'NOOP', 'SNAPPY', 'GZIP', 'LZ4' or 'ZSTD'.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
compress(
Uint8List data) → Uint8List -
Compress data synchronously
override
-
decompress(
Uint8List data, {int? size}) → Uint8List -
Decompress data synchronously
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited