1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-28 04:55:37 -05:00

FillFullFrom

This commit is contained in:
Darien Raymond
2016-12-05 17:05:47 +01:00
parent 10b75e8961
commit 186bf1f141
4 changed files with 40 additions and 37 deletions

View File

@@ -220,7 +220,14 @@ func (b *Buffer) Read(data []byte) (int, error) {
func (b *Buffer) FillFrom(reader io.Reader) (int, error) {
begin := b.Len()
nBytes, err := reader.Read(b.head[b.offset+begin:])
b.Value = b.head[:b.offset+begin+nBytes]
b.Value = b.head[b.offset : b.offset+begin+nBytes]
return nBytes, err
}
func (b *Buffer) FillFullFrom(reader io.Reader, amount int) (int, error) {
begin := b.Len()
nBytes, err := io.ReadFull(reader, b.head[b.offset+begin:b.offset+begin+amount])
b.Value = b.head[b.offset : b.offset+begin+nBytes]
return nBytes, err
}