mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 17:46:58 -05:00
remove unused code
This commit is contained in:
parent
8868fe68ed
commit
e362c74fa9
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user