mirror of
https://github.com/v2fly/v2ray-core
synced 2024-02-27 03:18:06 +00:00
refine buffer interface
This commit is contained in:
@@ -35,11 +35,6 @@ func (b *Buffer) Clear() {
|
||||
b.end = 0
|
||||
}
|
||||
|
||||
// AppendBytes appends one or more bytes to the end of the buffer.
|
||||
func (b *Buffer) AppendBytes(bytes ...byte) (int, error) {
|
||||
return b.Write(bytes)
|
||||
}
|
||||
|
||||
// AppendSupplier appends the content of a BytesWriter to the buffer.
|
||||
func (b *Buffer) AppendSupplier(writer Supplier) error {
|
||||
nBytes, err := writer(b.v[b.end:])
|
||||
@@ -145,6 +140,11 @@ func (b *Buffer) Write(data []byte) (int, error) {
|
||||
return nBytes, nil
|
||||
}
|
||||
|
||||
// WriteBytes appends one or more bytes to the end of the buffer.
|
||||
func (b *Buffer) WriteBytes(bytes ...byte) (int, error) {
|
||||
return b.Write(bytes)
|
||||
}
|
||||
|
||||
// Read implements io.Reader.Read().
|
||||
func (b *Buffer) Read(data []byte) (int, error) {
|
||||
if b.Len() == 0 {
|
||||
|
||||
Reference in New Issue
Block a user