aboutsummaryrefslogtreecommitdiff
path: root/internal/compress
diff options
context:
space:
mode:
Diffstat (limited to 'internal/compress')
-rw-r--r--internal/compress/flate/inflate.go13
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 {