1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-19 19:06:43 -05:00
v2fly/transport/pipe/writer.go

26 lines
662 B
Go
Raw Normal View History

2018-04-16 08:57:13 -04:00
package pipe
import (
"v2ray.com/core/common/buf"
)
2018-04-18 09:40:43 -04:00
// Writer is a buf.Writer that writes data into a pipe.
2018-04-16 08:57:13 -04:00
type Writer struct {
pipe *pipe
}
2018-04-18 09:40:43 -04:00
// WriteMultiBuffer implements buf.Writer.
2018-04-16 08:57:13 -04:00
func (w *Writer) WriteMultiBuffer(mb buf.MultiBuffer) error {
return w.pipe.WriteMultiBuffer(mb)
}
2018-04-18 09:40:43 -04:00
// Close implements io.Closer. After the pipe is closed, writing to the pipe will return io.ErrClosedPipe, while reading will return io.EOF.
2018-04-16 08:57:13 -04:00
func (w *Writer) Close() error {
return w.pipe.Close()
}
2018-04-18 09:40:43 -04:00
// CloseError sets the pipe to error state. Both reading and writing from/to the pipe will return io.ErrClosedPipe.
2018-04-16 08:57:13 -04:00
func (w *Writer) CloseError() {
w.pipe.CloseError()
}