K4os.Compression.LZ4.Streams Generic interface for frame/stream decoder for LZ4. Opens frame for reading. Please note, this method is not needed as it will be called automatically, but it can be used to quickly check if frame is valid. true if frame was just opened, false if it was opened before. Async version of . Cancellation token. true if frame was just opened, false if it was opened before. Gets the length of the frame content if it was provided when content was encoded. Frame length, or null Async version of . Cancellation token. Frame length, or null Reads one byte from LZ4 stream. A byte, or -1 if end of stream. Reads one byte from LZ4 stream. Cancellation token. A byte, or -1 if end of stream. Reads many bytes from LZ4 stream. Return number of bytes actually read. Byte buffer to read into. if true then returns as soon as some bytes are read, if false then waits for all bytes being read or end of stream. Number of bytes actually read. 0 means that end of stream has been reached. Reads many bytes from LZ4 stream. Return number of bytes actually read. Cancellation token. Byte buffer to read into. if true then returns as soon as some bytes are read, if false then waits for all bytes being read or end of stream. Number of bytes actually read. 0 means that end of stream has been reached. Returns how many bytes in has been read from stream so far. Number of bytes read in total. Closes the stream, releases allocated memory. Generic interface for LZ4 frame/stream writer. Opens a stream by reading frame header. Please note, this methods can be called explicitly but does not need to be called, it will be called automatically if needed. true if frame has been opened, or false if it was opened before. Opens a stream by reading frame header. Please note, this methods can be called explicitly but does not need to be called, it will be called automatically if needed. Cancellation token. true if frame has been opened, or false if it was opened before. Writes one byte to stream. Byte to be written. Writes one byte to stream. Cancellation token. Byte to be written. Writes multiple bytes to stream. Byte buffer. Writes multiple bytes to stream. Cancellation token. Byte buffer. Gets number of bytes written. Total number of bytes (before compression). Closes frame. Frame needs to be closed for stream to by valid, although this methods does not need to be called explicitly if stream is properly dispose. Closes frame. Frame needs to be closed for stream to by valid, although this methods does not need to be called explicitly if stream is properly dispose. Cancellation token. Stream reader interface. It is an adapter for all stream-like structures. Stream state. Reads at-most bytes from given . Stream state. Buffer to read bytes into. Offset in buffer. Maximum number of bytes to read. Number of bytes actually read. Reads at-most bytes from given . Stream state. Buffer to read bytes into. Offset in buffer. Maximum number of bytes to read. Cancellation token. containing new stream state, and number of bytes actually read.. Generic stream writer interface. When implementing custom compression target or decompression source you need to implement this adapter. Please note, that this adapter can be implemented as class or readonly struct. If implemented as struct it cannot have mutable state as it will be lost. Immutable state is allowed but strongly discouraged. Use instead. Mutable part of stream state. Indicates that writer can and should flush after frame. Please note, flushing may have negative performance effect but may also lead to better interactivity between writer and reader, as reader will get new block available as soon as possible. Writes byte buffer to underlying stream. Stream state. Byte buffer. Offset within buffer. Number of bytes. Writes byte buffer to underlying stream. Stream state. Byte buffer. Offset within buffer. Number of bytes. Cancellation token. New stream state (mutable part). Flushes buffers to underlying storage. Called only when Stream state. Flushes buffers to underlying storage. Called only when Stream state. Cancellation token. New stream state (mutable part). Result of async read operation. Returns new state of the stream and number of bytes read. New stream state. Number of bytes read. Stream state. Result of async read operation. Returns new state of the stream and number of bytes read. New stream state. Number of bytes read. Stream state. New stream state. Number of bytes read. Helper methods to create Creates read result, composed of new stream state and bytes read. Stream state. Bytes read. Stream state. Read result. Stream adapter for any class implementing . It takes actual class, not interface, so it can use struct implementations of for performance reasons. Please note, whole K4os.Compression.LZ4.Streams.Adapters namespace should be considered pubternal - exposed as public but still very likely to change. Type implementing Stream adapter for and . This class implements for but should be used only in some niche situations, as it is not easy to find out how many bytes has been written, use instead. Please note, whole K4os.Compression.LZ4.Streams.Adapters namespace should be considered pubternal - exposed as public but still very likely to change. Copies bytes from span to buffer. Performs all length checks. Head offset of . Target buffer. Offset in target buffer. Number of bytes to copy. Number of bytes actually copied. Stream adapter for and . This class implements for but should be used only in some niche situations, as it is not easy to find out how many bytes has been written, use instead. Please note, whole K4os.Compression.LZ4.Streams.Adapters namespace should be considered pubternal - exposed as public but still very likely to change. Initializes a new instance of the class. Memory buffer. Naive and simplistic implementation of adapter for . It might be improved in many ways I believe, but it gives some starting point. Please note, whole K4os.Compression.LZ4.Streams.Adapters namespace should be considered pubternal - exposed as public but still very likely to change. LZ4 stream reader/writer adapter for . Creates new instance of . Memory span. Empty record equivalent to Unit/Void. Works as placeholder type used when working with generic interfaces which do require type, but implementation needs none. Please note, whole K4os.Compression.LZ4.Streams.Adapters namespace should be considered pubternal - exposed as public but still very likely to change. Stream adapter for . Please note, whole K4os.Compression.LZ4.Streams.Adapters namespace should be considered pubternal - exposed as public but still very likely to change. Creates new instance of . Pipe reader. LZ4 stream adapter for . Please note, whole K4os.Compression.LZ4.Streams.Adapters namespace should be considered pubternal - exposed as public but still very likely to change. Creates new instance of . Pipe writer. LZ4 stream reader/writer adapter for . Please note, whole K4os.Compression.LZ4.Streams.Adapters namespace should be considered pubternal - exposed as public but still very likely to change. Creates new stream adapter for Unsafe version of . It is unsafe as it stores raw memory pointer so memory it points to must be pinned. It allows reading and writing straight to unmanaged memory but must be used carefully. NOTE: If you don't understand what has been said above - don't use it. Misuse of this struct may lead to unpredictable errors and memory corruption. Pointer to the first byte of the span. Length of the span in bytes. Creates new instance of from given pointer and length. Pointer to the first byte of the span. Length of the span in bytes. Creates new instance of from raw pointer. Pointer block of bytes. Length of the block. New . Converted to . Utility methods for LZ4 streams. Creates using . LZ4 descriptor. Compression level. Additional memory for encoder. Encoder. Creates using and . LZ4 descriptor. Encoder settings. Encoder. Create using . Descriptor. Extra memory (may improves speed, but creates memory pressure). . Create using and . Descriptor. Settings. . Creates from . Settings. LZ4 Descriptor. Async version of . Decoder. true if frame was just opened, false if it was opened before. Async version of . Decoder. Frame length, or null Reads one byte from LZ4 stream. Decoder. A byte, or -1 if end of stream. Reads many bytes from LZ4 stream. Return number of bytes actually read. Decoder. Byte buffer to read into. if true then returns as soon as some bytes are read, if false then waits for all bytes being read or end of stream. Number of bytes actually read. 0 means that end of stream has been reached. Opens a stream by reading frame header. Please note, this methods can be called explicitly but does not need to be called, it will be called automatically if needed. Encoder. true if frame has been opened, or false if it was opened before. Writes one byte to stream. Encoder. Byte to be written. Writes multiple bytes to stream. Encoder. Byte buffer. Closes frame. Frame needs to be closed for stream to by valid, although this methods does not need to be called explicitly if stream is properly dispose. Encoder. Copies all bytes from into . Frame reader. Buffer writer. Chunk size. Type of buffer writer. Copies all bytes from into . LZ4 frame reader. Buffer writer. Chunk size. Type of buffer writer. Copies all bytes from into . Frame writer. Sequence of bytes. Copies all bytes from into . Frame writer. Sequence of bytes. Wraps as . LZ4 frame reader. Indicates that frame reader should be left open even if stream is disposed. Indicates that data should be provided to reader as quick as possible, instead of waiting for whole block to be read. stream wrapper. Wraps as . LZ4 frame writer. Indicates that frame writer should be left open even if stream is disposed. stream wrapper. LZ4 Decompression stream handling. Creates new instance . Inner stream. Inner stream initial state. Decoder factory. Exposes internal stream state. Existence of this property is a hack, and it really shouldn't be here but it is needed for relatively low level operations (like writing directly to unmanaged memory). Please, do not use it directly, if don't know what you are doing. Allocate temporary buffer to store decompressed data. Minimum size of the buffer. Allocated buffer. Releases allocated buffer. Previously allocated buffer. Disposes the decoder. Consecutive attempts to read will fail. true is stream is being disposed by user, true is by garbage collector. Releases unmanaged resources. Releases unmanaged resources. Task indicating operation is finished. implementation for . Creates new instance of . Bytes span. LZ4 decoder factory. implementation for . Creates new instance of . Memory buffer. LZ4 decoder factory. implementation for . Creates new instance of . Byte sequence. LZ4 decoder factory. implementation for . Creates new instance of . Stream to read from. Leave stream open after reader is disposed. LZ4 decoder factory. Disposes the reader. true if user is disposing it; false if it has been triggered by garbage collector implementation for . Creates new instance of . Pipe to be read. Leave pipe open after reader is disposed. LZ4 decoder factory. wrapper for . Creates new instance of . LZ4 frame reader. Leave underlying stream open after disposing this stream. Use interactive mode; return bytes as soon as they available. Length of stream. Please note, this will only work if original LZ4 stream has ContentLength field set in descriptor. Otherwise returned value will be -1. It will also require synchronous stream access, so it wont work if AllowSynchronousIO is false. Position within the stream. Position can be read, but cannot be set as LZ4 stream does not have Seek capability. LZ4 stream encoder. Creates new instance of . Inner stream. Inner stream initial state. LZ4 Encoder factory. LZ4 settings. Exposes internal stream state. Existence of this field is a hack, and it really shouldn't be here but it is needed for relatively low level operations (like writing directly to unmanaged memory). Please, do not use it directly, if don't know what you are doing. Allocate temporary buffer to store decompressed data. Minimum size of the buffer. Allocated buffer. Releases allocated buffer. Previously allocated buffer. Disposes the stream and releases all resources. true if called by user; false when called by garbag collector. Releases all unmanaged resources. Releases all unmanaged resources. Task indicating completion of the operation. implementation for Type of buffer writer. Creates new instance of . Buffer writer to write to. Encoder factory. Frame descriptor. Current state of buffer writer. implementation for Creates new instance of . Buffer writer to write to. Encoder factory. Frame descriptor. implementation for Creates new instance of . Memory block where data will be written. Encoder factory. Frame descriptor. Number of bytes written to the memory. implementation for . is a wrapper around that can be stored in a field. Please note: it makes it unsafe and address needs to be pinned, one way or another. Creates new instance of . Span to write to. Encoder factory. Frame descriptor. Number of bytes written to the memory. implementation for . Creates new instance of . Stream to write to. Leave stream open after disposing this writer. Encoder factory. Frame descriptor. implementation for . Creates new instance of . Pipe writer to write to. Leave pipe open after disposing this writer. Encoder factory. Frame descriptor. Adapter to make look like . Creates new instance of . Underlying frame encoder. Indicates should be left open after disposing. Length of the stream and number of bytes written so far. Read-only position in the stream. Trying to set it will throw . LZ4 Frame descriptor. Content length. Not always known. Indicates if content checksum is provided. Indicates if blocks are chained (dependent) or not (independent). Indicates if block checksums are provided. Dictionary id. May be null. Block size. Completely empty class to do nothing. It is used internally instead of CancellationToken to make sure blocking operations are easily distinguishable from async ones (you cannot call blocking operation by accident as they *require* EmptyToken). Base class for all compatible adapters. Type of resource stream adapter if for. Creates new instance of . Wrapped resource. Do not dispose inner resource after stream is disposed. Wrapped resource. LZ4 stream essentials when wrapping another stream. You most likely should not use it but it needs to be public as it is inherited from. Decoder settings. Extra memory for decompression. LZ4 frame decoder stream. Creates LZ4 decoder stream. Inner stream, the stream compressed data is coming from.. Decoder factory. Leave inner stream open after this stream is disposed. Interactive mode, provide bytes as soon as they are available; don't wait for full block. Length of stream. Please note, this will only work if original LZ4 stream has ContentLength field set in descriptor. Otherwise returned value will be -1. It will also require synchronous stream access, so it wont work if AllowSynchronousIO is false. Position within the stream. Position can be read, but cannot be set as LZ4 stream does not have Seek capability. LZ4 frame descriptor. Content length (if available). Indicates if content checksum if present. Indicates if blocks are chained. Indicates if block checksums are present. Dictionary id (or null). Block size. Creates new instance of . Content length. Content checksum flag. Chaining flag. Block checksum flag. Dictionary id. Block size. Creates new instance of . Descriptor to copy. LZ4 encoder settings. Content length. It is not enforced, it can be set to any value, but it will be written to the stream so it can be used while decoding. If you don't know the length just leave default value. Indicates if blocks should be chained (dependent) or not (independent). Dependent blocks (with chaining) provide better compression ratio but are a little but slower and take more memory. Block size. You can use any block size, but default values for LZ4 are 64k, 256k, 1m, and 4m. 64k is good enough for dependent blocks, but for independent blocks bigger is better. Indicates is content checksum should be included. Indicates if block checksum should be included. Dictionary id. Not implemented yet. Compression level. Extra memory (for the process, more is usually better). LZ4 frame encoder stream. Creates new instance of . Inner stream. LZ4 Descriptor. Function which will take descriptor and return appropriate encoder. Indicates if stream should be left open after disposing. Length of the stream and number of bytes written so far. Read-only position in the stream. Trying to set it will throw . LZ4 factory methods to encode/decode anything which can be represented as a stream-like object. Please note, to avoid all the complexity of dealing with streams, it uses and as stream abstractions. Creates decompression stream on top of inner stream. Span to read from. Buffer to write to. Extra memory used for decompression. Creates decompression stream on top of inner stream. Stream to be decoded. Extra memory used for decompression. Decompression stream. Creates decompression stream on top of inner stream. Stream to be decoded. Extra memory used for decompression. Decompression stream. Creates decompression stream on top of inner stream. Stream to be decoded. Extra memory used for decompression. Indicates if stream should stay open after disposing decoder. Decompression stream. Creates decompression stream on top of inner stream. Stream to be decoded. Extra memory used for decompression. Indicates if stream should stay open after disposing decoder. Decompression stream. Compresses source bytes into target buffer. Returns number of bytes actually written. Source bytes. Target buffer. Compression settings. Number of bytes actually written. Compresses source bytes into target buffer. Returns number of bytes actually written. Source bytes. Target buffer. Compression settings. Number of bytes actually written. Compresses source bytes into target buffer. Returns number of bytes actually written. Source bytes. Target buffer. Compression level. Extra memory. Number of bytes actually written. Compresses source bytes into target buffer. Returns number of bytes actually written. Source bytes. Target buffer. Compression level. Extra memory. Number of bytes actually written. Compresses source bytes into target buffer. Returns number of bytes actually written. Source bytes. Target buffer. Compression settings. Number of bytes actually written. Compresses source bytes into target buffer. Returns number of bytes actually written. Source bytes. Target buffer. Compression settings. Number of bytes actually written. Writes bytes into target buffer. Returns number of bytes actually written. Source of bytes, a function which write to LZ4 encoder. Target buffer. Compression settings. Number of bytes actually written. Compresses source bytes into target buffer. Returns number of bytes actually written. Source bytes. Target buffer. Compression level. Extra memory for encoder. Number of bytes actually written. Compresses source bytes into target buffer. Returns number of bytes actually written. Source bytes. Target buffer. Compression level. Extra memory for encoder. Number of bytes actually written. Compresses source bytes into target buffer. Returns number of bytes actually written. Source of bytes, a function which write to LZ4 encoder. Target buffer. Compression level. Extra memory for encoder. Number of bytes actually written. Create LZ4 encoder that writes compressed data into target buffer. Please note, target buffer needs to be pinned for the whole time encoder is used. This is definitely very unsafe method, and if you don't understand what it does, don't use it. Pointer to target buffer. Length of target buffer. Encoder settings. LZ4 frame writer. Create LZ4 encoder that writes compressed data into target buffer. Please note, target buffer needs to be pinned for the whole time encoder is used. This is definitely very unsafe method, and if you don't understand what it does, don't use it. Pointer to target buffer. Length of target buffer. Compression level. Extra memory for encoder. LZ4 frame writer. Create LZ4 encoder that writes compressed data into target buffer. Target buffer. Encoder settings. LZ4 frame writer. Create LZ4 encoder that writes compressed data into target buffer. Target buffer. Compression level. Extra memory for encoder. LZ4 frame writer. Create LZ4 encoder that writes compressed data into target buffer. Target buffer. Encoder settings. Byte of buffer writer implementing . LZ4 frame writer. Create LZ4 encoder that writes compressed data into target buffer. Target buffer. Compression level. Extra memory for encoder. Byte of buffer writer implementing . LZ4 frame writer. Create LZ4 encoder that writes compressed data into target buffer. Target buffer. Encoder settings. LZ4 frame writer. Create LZ4 encoder that writes compressed data into target buffer. Target buffer. Compression level. Extra memory for encoder. LZ4 frame writer. Create LZ4 encoder that writes compressed data into target stream. Target stream. Encoder settings. Leave target stream open after encoder is disposed. LZ4 frame writer. Create LZ4 encoder that writes compressed data into target stream. Target stream. Compression level. Extra memory for encoder. Leave target stream open after encoder is disposed. Create LZ4 encoder that writes compressed data into target pipe. Target pipe. Encoder settings. Leave target pipe open after encoder is disposed. LZ4 frame writer. Create LZ4 encoder that writes compressed data into target pipe. Target pipe. Compression level. Extra memory for encoder. Leave target pipe open after encoder is disposed. LZ4 frame writer. Utility class with factory methods to create LZ4 compression and decompression streams. Created compression stream on top of inner stream. Inner stream. Compression settings. Leave inner stream open after disposing. Compression stream. Created compression stream on top of inner stream. Inner stream. Compression level. Extra memory used for compression. Leave inner stream open after disposing. Compression stream. Creates decompression stream on top of inner stream. Inner stream. Decompression settings. Leave inner stream open after disposing. If true reading from stream will be "interactive" allowing to read bytes as soon as possible, even if more data is expected. Decompression stream. Creates decompression stream on top of inner stream. Inner stream. Extra memory used for decompression. Leave inner stream open after disposing. If true reading from stream will be "interactive" allowing to read bytes as soon as possible, even if more data is expected. Decompression stream.