summaryrefslogtreecommitdiff
path: root/vendor/github.com/klauspost/compress/zstd/decoder.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-01-23 06:15:18 -0800
committerGitHub <noreply@github.com>2020-01-23 06:15:18 -0800
commitf037f24b67c4fd95c9b85ecf40a7ba6d9c7dd7f6 (patch)
tree96665286b569c8cf79f43ef9adad7f1502eefbed /vendor/github.com/klauspost/compress/zstd/decoder.go
parent8098cbbee192e644de505e62c4aa0341f4acb4a5 (diff)
parent587a25fd8a9f903ffc45d6ca7442da3966f7443c (diff)
downloadpodman-f037f24b67c4fd95c9b85ecf40a7ba6d9c7dd7f6.tar.gz
podman-f037f24b67c4fd95c9b85ecf40a7ba6d9c7dd7f6.tar.bz2
podman-f037f24b67c4fd95c9b85ecf40a7ba6d9c7dd7f6.zip
Merge pull request #4947 from containers/dependabot/go_modules/github.com/containers/storage-1.15.7
build(deps): bump github.com/containers/storage from 1.15.5 to 1.15.7
Diffstat (limited to 'vendor/github.com/klauspost/compress/zstd/decoder.go')
-rw-r--r--vendor/github.com/klauspost/compress/zstd/decoder.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/vendor/github.com/klauspost/compress/zstd/decoder.go b/vendor/github.com/klauspost/compress/zstd/decoder.go
index 1de94eef0..35a3cda91 100644
--- a/vendor/github.com/klauspost/compress/zstd/decoder.go
+++ b/vendor/github.com/klauspost/compress/zstd/decoder.go
@@ -388,6 +388,35 @@ func (d *Decoder) Close() {
d.current.err = ErrDecoderClosed
}
+// IOReadCloser returns the decoder as an io.ReadCloser for convenience.
+// Any changes to the decoder will be reflected, so the returned ReadCloser
+// can be reused along with the decoder.
+// io.WriterTo is also supported by the returned ReadCloser.
+func (d *Decoder) IOReadCloser() io.ReadCloser {
+ return closeWrapper{d: d}
+}
+
+// closeWrapper wraps a function call as a closer.
+type closeWrapper struct {
+ d *Decoder
+}
+
+// WriteTo forwards WriteTo calls to the decoder.
+func (c closeWrapper) WriteTo(w io.Writer) (n int64, err error) {
+ return c.d.WriteTo(w)
+}
+
+// Read forwards read calls to the decoder.
+func (c closeWrapper) Read(p []byte) (n int, err error) {
+ return c.d.Read(p)
+}
+
+// Close closes the decoder.
+func (c closeWrapper) Close() error {
+ c.d.Close()
+ return nil
+}
+
type decodeOutput struct {
d *blockDec
b []byte