162 references to ZLibNative
System.IO.Compression (162)
LibraryImports.g.cs (19)
7
internal static unsafe extern partial global::System.IO.Compression.
ZLibNative
.ErrorCode DeflateInit2_(global::System.IO.Compression.
ZLibNative
.ZStream* stream, global::System.IO.Compression.
ZLibNative
.CompressionLevel level, global::System.IO.Compression.
ZLibNative
.CompressionMethod method, int windowBits, int memLevel, global::System.IO.Compression.
ZLibNative
.CompressionStrategy strategy);
15
internal static unsafe extern partial global::System.IO.Compression.
ZLibNative
.ErrorCode Deflate(global::System.IO.Compression.
ZLibNative
.ZStream* stream, global::System.IO.Compression.
ZLibNative
.FlushCode flush);
23
internal static unsafe extern partial global::System.IO.Compression.
ZLibNative
.ErrorCode DeflateEnd(global::System.IO.Compression.
ZLibNative
.ZStream* stream);
31
internal static unsafe extern partial global::System.IO.Compression.
ZLibNative
.ErrorCode InflateInit2_(global::System.IO.Compression.
ZLibNative
.ZStream* stream, int windowBits);
39
internal static unsafe extern partial global::System.IO.Compression.
ZLibNative
.ErrorCode InflateReset2_(global::System.IO.Compression.
ZLibNative
.ZStream* stream, int windowBits);
47
internal static unsafe extern partial global::System.IO.Compression.
ZLibNative
.ErrorCode Inflate(global::System.IO.Compression.
ZLibNative
.ZStream* stream, global::System.IO.Compression.
ZLibNative
.FlushCode flush);
55
internal static unsafe extern partial global::System.IO.Compression.
ZLibNative
.ErrorCode InflateEnd(global::System.IO.Compression.
ZLibNative
.ZStream* stream);
src\libraries\Common\src\Interop\Interop.zlib.cs (19)
12
internal static unsafe partial
ZLibNative
.ErrorCode DeflateInit2_(
13
ZLibNative
.ZStream* stream,
14
ZLibNative
.CompressionLevel level,
15
ZLibNative
.CompressionMethod method,
18
ZLibNative
.CompressionStrategy strategy);
21
internal static unsafe partial
ZLibNative
.ErrorCode Deflate(
ZLibNative
.ZStream* stream,
ZLibNative
.FlushCode flush);
24
internal static unsafe partial
ZLibNative
.ErrorCode DeflateEnd(
ZLibNative
.ZStream* stream);
27
internal static unsafe partial
ZLibNative
.ErrorCode InflateInit2_(
ZLibNative
.ZStream* stream, int windowBits);
30
internal static unsafe partial
ZLibNative
.ErrorCode InflateReset2_(
ZLibNative
.ZStream* stream, int windowBits);
33
internal static unsafe partial
ZLibNative
.ErrorCode Inflate(
ZLibNative
.ZStream* stream,
ZLibNative
.FlushCode flush);
36
internal static unsafe partial
ZLibNative
.ErrorCode InflateEnd(
ZLibNative
.ZStream* stream);
src\libraries\Common\src\System\IO\Compression\ZLibNative.cs (3)
162
* Do not remove the nested typing of types inside of <see cref="
ZLibNative
" />.
165
* - Achieve the right encapsulation in a situation where <see cref="
ZLibNative
" /> may be compiled division-wide
167
* scope is effectively like <c>public</c> scope when compiling <see cref="
ZLibNative
" /> into a higher
src\libraries\Common\src\System\IO\Compression\ZLibNative.ZStream.cs (2)
13
/// Always use <see cref="
ZLibNative
.ZLibStreamHandle.CreateForDeflate" /> or <see cref="
ZLibNative
.ZLibStreamHandle.CreateForInflate" /> instead.
System\IO\Compression\CompressionFormat.cs (1)
33
windowLog =
ZLibNative
.DefaultWindowLog;
System\IO\Compression\DeflateDecoder.cs (9)
15
private
ZLibNative
.ZLibStreamHandle? _state;
24
: this(
ZLibNative
.Deflate_DefaultWindowBits)
30
_state =
ZLibNative
.ZLibStreamHandle.CreateForInflate(windowBits);
84
ZLibNative
.ErrorCode errorCode = _state.Inflate(
ZLibNative
.FlushCode.NoFlush);
91
ZLibNative
.ErrorCode.Ok or
ZLibNative
.ErrorCode.BufError => _state.AvailOut == 0
94
ZLibNative
.ErrorCode.StreamEnd => OperationStatus.Done,
99
if (errorCode ==
ZLibNative
.ErrorCode.StreamEnd)
System\IO\Compression\DeflateEncoder.cs (36)
15
private
ZLibNative
.ZLibStreamHandle? _state;
24
: this(
ZLibNative
.DefaultQuality)
35
: this(quality,
ZLibNative
.DefaultWindowLog)
73
int memLevel = quality == (int)
ZLibNative
.CompressionLevel.NoCompression
74
?
ZLibNative
.Deflate_NoCompressionMemLevel
75
:
ZLibNative
.Deflate_DefaultMemLevel;
77
_state =
ZLibNative
.ZLibStreamHandle.CreateForDeflate(
78
(
ZLibNative
.CompressionLevel)quality,
81
ZLibNative
.CompressionStrategy.DefaultStrategy);
93
int memLevel = options.CompressionLevel == (int)
ZLibNative
.CompressionLevel.NoCompression
94
?
ZLibNative
.Deflate_NoCompressionMemLevel
95
:
ZLibNative
.Deflate_DefaultMemLevel;
97
_state =
ZLibNative
.ZLibStreamHandle.CreateForDeflate(
98
(
ZLibNative
.CompressionLevel)options.CompressionLevel,
101
(
ZLibNative
.CompressionStrategy)options.CompressionStrategy);
108
ArgumentOutOfRangeException.ThrowIfLessThan(quality,
ZLibNative
.MinQuality, nameof(quality));
109
ArgumentOutOfRangeException.ThrowIfGreaterThan(quality,
ZLibNative
.MaxQuality, nameof(quality));
117
ArgumentOutOfRangeException.ThrowIfLessThan(windowLog,
ZLibNative
.MinWindowLog, nameof(windowLog));
118
ArgumentOutOfRangeException.ThrowIfGreaterThan(windowLog,
ZLibNative
.MaxWindowLog, nameof(windowLog));
212
ZLibNative
.FlushCode flushCode = isFinalBlock ?
ZLibNative
.FlushCode.Finish :
ZLibNative
.FlushCode.NoFlush;
224
ZLibNative
.ErrorCode errorCode = _state.Deflate(flushCode);
231
ZLibNative
.ErrorCode.Ok when isFinalBlock => OperationStatus.DestinationTooSmall,
232
ZLibNative
.ErrorCode.Ok => _state.AvailIn == 0
235
ZLibNative
.ErrorCode.StreamEnd => OperationStatus.Done,
236
ZLibNative
.ErrorCode.BufError => _state.AvailOut == 0
243
if (isFinalBlock && errorCode ==
ZLibNative
.ErrorCode.StreamEnd)
280
ZLibNative
.ErrorCode errorCode = _state.Deflate(
ZLibNative
.FlushCode.SyncFlush);
286
ZLibNative
.ErrorCode.Ok => _state.AvailOut == 0
289
ZLibNative
.ErrorCode.StreamEnd => OperationStatus.Done,
290
ZLibNative
.ErrorCode.BufError => _state.AvailOut == 0
307
=> TryCompress(source, destination, out bytesWritten,
ZLibNative
.DefaultQuality,
ZLibNative
.DefaultWindowLog);
318
=> TryCompress(source, destination, out bytesWritten, quality,
ZLibNative
.DefaultWindowLog);
System\IO\Compression\DeflateZLib\Deflater.cs (9)
7
using ZErrorCode = System.IO.Compression.
ZLibNative
.ErrorCode;
8
using ZFlushCode = System.IO.Compression.
ZLibNative
.FlushCode;
17
private readonly
ZLibNative
.ZLibStreamHandle _zlibStream;
30
private Deflater(
ZLibNative
.ZLibStreamHandle zlibStream)
163
_zlibStream.NextIn =
ZLibNative
.ZNullPtr;
199
public static Deflater CreateDeflater(
ZLibNative
.CompressionLevel compressionLevel,
ZLibNative
.CompressionStrategy strategy, int windowBits, int memLevel)
203
ZLibNative
.ZLibStreamHandle zlibStream =
ZLibNative
.ZLibStreamHandle.CreateForDeflate(compressionLevel, windowBits, memLevel, strategy);
System\IO\Compression\DeflateZLib\DeflateStream.cs (15)
10
using static System.IO.Compression.
ZLibNative
;
27
internal DeflateStream(Stream stream, CompressionMode mode, long uncompressedSize) : this(stream, mode, leaveOpen: false,
ZLibNative
.Deflate_DefaultWindowBits, uncompressedSize)
35
public DeflateStream(Stream stream, CompressionMode mode, bool leaveOpen) : this(stream, mode, leaveOpen,
ZLibNative
.Deflate_DefaultWindowBits)
45
public DeflateStream(Stream stream, CompressionLevel compressionLevel, bool leaveOpen) : this(stream, compressionLevel, leaveOpen,
ZLibNative
.Deflate_DefaultWindowBits)
63
InitializeDeflater(stream, (
ZLibNative
.CompressionLevel)compressionOptions.CompressionLevel, (CompressionStrategy)compressionOptions.CompressionStrategy, leaveOpen, windowBits);
71
InitializeDeflater(stream, (
ZLibNative
.CompressionLevel)compressionOptions.CompressionLevel, (CompressionStrategy)compressionOptions.CompressionStrategy, leaveOpen, windowBits);
95
InitializeDeflater(stream,
ZLibNative
.CompressionLevel.DefaultCompression, CompressionStrategy.DefaultStrategy, leaveOpen, windowBits);
117
internal void InitializeDeflater(Stream stream,
ZLibNative
.CompressionLevel compressionLevel, CompressionStrategy strategy, bool leaveOpen, int windowBits)
131
private static
ZLibNative
.CompressionLevel GetZLibNativeCompressionLevel(CompressionLevel compressionLevel) =>
134
CompressionLevel.Optimal =>
ZLibNative
.CompressionLevel.DefaultCompression,
135
CompressionLevel.Fastest =>
ZLibNative
.CompressionLevel.BestSpeed,
136
CompressionLevel.NoCompression =>
ZLibNative
.CompressionLevel.NoCompression,
137
CompressionLevel.SmallestSize =>
ZLibNative
.CompressionLevel.BestCompression,
141
private static int GetMemLevel(
ZLibNative
.CompressionLevel level) =>
142
level ==
ZLibNative
.CompressionLevel.NoCompression ?
System\IO\Compression\DeflateZLib\Inflater.cs (21)
22
private readonly
ZLibNative
.ZLibStreamHandle _zlibStream; // The handle to the primary underlying zlib stream
29
private Inflater(int windowBits, long uncompressedSize,
ZLibNative
.ZLibStreamHandle zlibStream)
119
if (ReadInflateOutput(bufPtr, length,
ZLibNative
.FlushCode.NoFlush, out bytesRead) ==
ZLibNative
.ErrorCode.StreamEnd)
150
if (*nextInPointer !=
ZLibNative
.GZip_Header_ID1 || (nextAvailIn > 1 && *(nextInPointer + 1) !=
ZLibNative
.GZip_Header_ID2))
233
private unsafe
ZLibNative
.ErrorCode ReadInflateOutput(byte* bufPtr, int length,
ZLibNative
.FlushCode flushCode, out int bytesRead)
240
ZLibNative
.ErrorCode errC = Inflate(flushCode);
250
private
ZLibNative
.ErrorCode Inflate(
ZLibNative
.FlushCode flushCode)
252
ZLibNative
.ErrorCode errC;
263
case
ZLibNative
.ErrorCode.Ok: // progress has been made inflating
264
case
ZLibNative
.ErrorCode.StreamEnd: // The end of the input stream has been reached
267
case
ZLibNative
.ErrorCode.BufError: // No room in the output buffer - inflate() can be called again with more space to continue
270
case
ZLibNative
.ErrorCode.MemError: // Not enough memory to complete the operation
273
case
ZLibNative
.ErrorCode.DataError: // The input data was corrupted (input stream not conforming to the zlib format or incorrect check value)
276
case
ZLibNative
.ErrorCode.StreamError: //the stream structure was inconsistent (for example if next_in or next_out was NULL),
296
_zlibStream.NextIn =
ZLibNative
.ZNullPtr;
307
ZLibNative
.ZLibStreamHandle zlibStream =
ZLibNative
.ZLibStreamHandle.CreateForInflate(windowBits);
System\IO\Compression\DeflateZLib\ZLibException.cs (4)
18
private readonly
ZLibNative
.ErrorCode _zlibErrorCode =
ZLibNative
.ErrorCode.Ok;
31
_zlibErrorCode = (
ZLibNative
.ErrorCode)zlibErrorCode;
61
_zlibErrorCode = (
ZLibNative
.ErrorCode)info.GetInt32("zlibErrorCode");
System\IO\Compression\GZipDecoder.cs (1)
22
_deflateDecoder = new DeflateDecoder(
ZLibNative
.GZip_DefaultWindowBits);
System\IO\Compression\GZipEncoder.cs (6)
21
: this(
ZLibNative
.DefaultQuality,
ZLibNative
.DefaultWindowLog)
32
: this(quality,
ZLibNative
.DefaultWindowLog)
130
=> TryCompress(source, destination, out bytesWritten,
ZLibNative
.DefaultQuality,
ZLibNative
.DefaultWindowLog);
141
=> TryCompress(source, destination, out bytesWritten, quality,
ZLibNative
.DefaultWindowLog);
System\IO\Compression\GZipStream.cs (2)
21
_deflateStream = new DeflateStream(stream, mode, leaveOpen,
ZLibNative
.GZip_DefaultWindowBits);
32
_deflateStream = new DeflateStream(stream, compressionLevel, leaveOpen,
ZLibNative
.GZip_DefaultWindowBits);
System\IO\Compression\ZLibCompressionOptions.cs (7)
12
public static int DefaultWindowLog =>
ZLibNative
.DefaultWindowLog;
15
public static int MinWindowLog =>
ZLibNative
.MinWindowLog;
18
public static int MaxWindowLog =>
ZLibNative
.MaxWindowLog;
39
ArgumentOutOfRangeException.ThrowIfLessThan(value,
ZLibNative
.MinQuality, nameof(value));
40
ArgumentOutOfRangeException.ThrowIfGreaterThan(value,
ZLibNative
.MaxQuality, nameof(value));
79
ArgumentOutOfRangeException.ThrowIfLessThan(value,
ZLibNative
.MinWindowLog, nameof(value));
80
ArgumentOutOfRangeException.ThrowIfGreaterThan(value,
ZLibNative
.MaxWindowLog, nameof(value));
System\IO\Compression\ZLibDecoder.cs (1)
22
_deflateDecoder = new DeflateDecoder(
ZLibNative
.ZLib_DefaultWindowBits);
System\IO\Compression\ZLibEncoder.cs (5)
21
: this(
ZLibNative
.DefaultQuality)
32
: this(quality,
ZLibNative
.DefaultWindowLog)
122
=> TryCompress(source, destination, out bytesWritten,
ZLibNative
.DefaultQuality,
ZLibNative
.DefaultWindowLog);
133
=> TryCompress(source, destination, out bytesWritten, quality,
ZLibNative
.DefaultWindowLog);
System\IO\Compression\ZLibStream.cs (2)
29
_deflateStream = new DeflateStream(stream, mode, leaveOpen,
ZLibNative
.ZLib_DefaultWindowBits);
45
_deflateStream = new DeflateStream(stream, compressionLevel, leaveOpen,
ZLibNative
.ZLib_DefaultWindowBits);