mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
rename bytes.Buffer.Data() to bytes.Buffer.Bytes()
R=rsc DELTA=152 (6 added, 0 deleted, 146 changed) OCL=34695 CL=34701
This commit is contained in:
parent
2a1c9377d9
commit
d5be41fc4e
30 changed files with 111 additions and 105 deletions
|
|
@ -26,14 +26,20 @@ type Buffer struct {
|
|||
off int; // read at &buf[off], write at &buf[len(buf)]
|
||||
}
|
||||
|
||||
// Data returns the contents of the unread portion of the buffer;
|
||||
// len(b.Data()) == b.Len().
|
||||
func (b *Buffer) Data() []byte {
|
||||
// Bytes returns the contents of the unread portion of the buffer;
|
||||
// len(b.Bytes()) == b.Len().
|
||||
func (b *Buffer) Bytes() []byte {
|
||||
return b.buf[b.off : len(b.buf)]
|
||||
}
|
||||
|
||||
// String returns the contents of the unread portion of the buffer
|
||||
// as a string.
|
||||
func (b *Buffer) String() string {
|
||||
return string(b.buf[b.off : len(b.buf)])
|
||||
}
|
||||
|
||||
// Len returns the number of bytes of the unread portion of the buffer;
|
||||
// b.Len() == len(b.Data()).
|
||||
// b.Len() == len(b.Bytes()).
|
||||
func (b *Buffer) Len() int {
|
||||
return len(b.buf) - b.off
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue