From e362c74fa9c75a941fd91c73d915e30cdd59599b Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Mon, 17 Apr 2017 22:38:33 +0200 Subject: [PATCH] remove unused code --- common/buf/buffered_writer.go | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/common/buf/buffered_writer.go b/common/buf/buffered_writer.go index c1d0e6c5..94dff184 100644 --- a/common/buf/buffered_writer.go +++ b/common/buf/buffered_writer.go @@ -1,10 +1,6 @@ package buf -import ( - "io" - - "v2ray.com/core/common/errors" -) +import "io" // BufferedWriter is an io.Writer with internal buffer. It writes to underlying writer when buffer is full or on demand. // This type is not thread safe. @@ -23,25 +19,6 @@ func NewBufferedWriter(rawWriter io.Writer) *BufferedWriter { } } -// ReadFrom implements io.ReaderFrom.ReadFrom(). -func (v *BufferedWriter) ReadFrom(reader io.Reader) (int64, error) { - totalBytes := int64(0) - for { - oriSize := v.buffer.Len() - err := v.buffer.AppendSupplier(ReadFrom(reader)) - totalBytes += int64(v.buffer.Len() - oriSize) - if err != nil { - if errors.Cause(err) == io.EOF { - return totalBytes, nil - } - return totalBytes, err - } - if err := v.Flush(); err != nil { - return totalBytes, err - } - } -} - func (v *BufferedWriter) Write(b []byte) (int, error) { if !v.buffered || v.buffer == nil { return v.writer.Write(b)