diff options
| author | 2026-03-05 18:04:22 +0800 | |
|---|---|---|
| committer | 2026-03-05 18:38:33 +0800 | |
| commit | fdf1bd9a68091a1640b79fcb4ea979ed10f8b904 (patch) | |
| tree | b7b07f0e389fef267a2760fc6a4328c9e881e6a7 | |
| parent | internal/compress: Import flate and such from klauspost/compress (diff) | |
| signature | No signature | |
internal/compress/flate: Add InputConsumed
| -rw-r--r-- | internal/compress/flate/inflate.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/compress/flate/inflate.go b/internal/compress/flate/inflate.go index 6e90126d..d200d244 100644 --- a/internal/compress/flate/inflate.go +++ b/internal/compress/flate/inflate.go @@ -286,6 +286,14 @@ type Reader interface { io.ByteReader } +// InputProgress reports compressed input bytes consumed by inflate state. +// +// InputConsumed returns bytes that have been consumed by the decompressor's +// parser and state machine, not bytes merely read ahead from the source. +type InputProgress interface { + InputConsumed() int64 +} + type step uint8 const ( @@ -344,6 +352,11 @@ type decompressor struct { flushMode flushMode } +// InputConsumed returns compressed input bytes consumed by receiver. +func (f *decompressor) InputConsumed() int64 { + return f.roffset +} + func (f *decompressor) nextBlock() { for f.nb < 1+2 { if f.err = f.moreBits(); f.err != nil { |
