Skip to content

CompressionExtensions Class ​

Definition ​

Provides extension methods for Compression detection methods. Lives in the JASE.Extensions namespace so call sites resolve via a shared import, but ships in JASE.Compression because it depends on compression detection.

  • Namespace: JASE.Extensions
  • Assembly: JASE.Compression.dll

Methods ​

NameDescription
bool HasGZipHeader(ReadOnlySpan<byte> bytes)Returns true if the span starts with GZip header bytes
bool HasGZipHeader(Stream stream)Returns true if the stream starts with GZip file header bytes
bool HasGZipHeader(byte[] bytes)Returns true if the byte array starts with GZip file header bytes
bool HasZipHeader(ReadOnlySpan<byte> bytes)Returns true if the span starts with Zip file header bytes
bool HasZipHeader(Stream stream)Returns true if the stream starts with Zip file header bytes
bool HasZipHeader(byte[] bytes)Returns true if the byte array starts with Zip file header bytes
bool IsLikelyBrotli(ReadOnlySpan<byte> bytes, int maxInputBytes = null, int maxOutputBytes = null)Best-effort Brotli detection by attempting a bounded decompression. This is NOT a magic-byte check and may yield false negatives/positives on arbitrary data.
bool IsLikelyBrotli(byte[] bytes)Returns true if the byte array starts with Zip file header bytes