remove unused code

pull/432/merge
Darien Raymond 8 years ago
parent 8868fe68ed
commit e362c74fa9
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

@ -1,10 +1,6 @@
package buf package buf
import ( import "io"
"io"
"v2ray.com/core/common/errors"
)
// BufferedWriter is an io.Writer with internal buffer. It writes to underlying writer when buffer is full or on demand. // 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. // 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) { func (v *BufferedWriter) Write(b []byte) (int, error) {
if !v.buffered || v.buffer == nil { if !v.buffered || v.buffer == nil {
return v.writer.Write(b) return v.writer.Write(b)

Loading…
Cancel
Save