| 1 | package test |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "io" |
| 6 | ) |
| 7 | |
| 8 | type wrappedReader struct { |
| 9 | io.Reader |
| 10 | } |
| 11 | |
| 12 | func (r *wrappedReader) ReadContext(ctx context.Context, b []byte) (int, error) { |
| 13 | return r.Reader.Read(b) |
| 14 | } |
| 15 | |
| 16 | type wrappedWriter struct { |
| 17 | io.Writer |
| 18 | } |
| 19 | |
| 20 | func (r *wrappedWriter) WriteContext(ctx context.Context, b []byte) (int, error) { |
| 21 | return r.Writer.Write(b) |
| 22 | } |
| 23 | |
| 24 | type wrappedReadWriter struct { |
| 25 | io.ReadWriter |
| 26 | } |
| 27 | |
| 28 | func (r *wrappedReadWriter) ReadContext(ctx context.Context, b []byte) (int, error) { |
| 29 | return r.ReadWriter.Read(b) |
| 30 | } |
| 31 | |
| 32 | func (r *wrappedReadWriter) WriteContext(ctx context.Context, b []byte) (int, error) { |
| 33 | return r.ReadWriter.Write(b) |
| 34 | } |