1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-18 02:16:10 -05:00

remove unused code

This commit is contained in:
Darien Raymond 2017-04-17 22:38:33 +02:00
parent 8868fe68ed
commit e362c74fa9
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -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)