Ejemplo n.º 1
0
        public static ulong GetDecompressedSize(ReadOnlySpan <byte> src)
        {
            var size = ExternMethods.ZSTD_getFrameContentSize(src, (size_t)src.Length);

            if (size == ExternMethods.ZSTD_CONTENTSIZE_UNKNOWN)
            {
                throw new ZstdException(ZSTD_ErrorCode.ZSTD_error_GENERIC, "Decompressed content size is not specified");
            }
            if (size == ExternMethods.ZSTD_CONTENTSIZE_ERROR)
            {
                throw new ZstdException(ZSTD_ErrorCode.ZSTD_error_GENERIC, "Decompressed content size cannot be determined (e.g. invalid magic number, srcSize too small)");
            }
            return(size);
        }