Browse Source

2021-01-05 05:52

zry 3 years ago
parent
commit
f69b3ea557
1 changed files with 11 additions and 1 deletions
  1. 11 1
      reader_writer.go

+ 11 - 1
reader_writer.go

@@ -1,6 +1,9 @@
 package zioutil
 
-import "io"
+import (
+	"fmt"
+	"io"
+)
 
 type ReadWriterBind struct {
 	Reader io.Reader
@@ -70,3 +73,10 @@ type NullWriter struct {
 func (nw NullWriter) Write(b []byte) (int, error) {
 	return len(b), nil
 }
+
+type NullReader struct {
+}
+
+func (nw NullReader) Read(b []byte) (int, error) {
+	return 0, fmt.Errorf("null reader")
+}