Documentation ¶
Overview ¶
Copyright 2021-2024 antlabs. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- type FixedReader
- func (b *FixedReader) Available() int64
- func (b *FixedReader) BufPtr() *[]byte
- func (b *FixedReader) Buffered() int
- func (b *FixedReader) Bytes() []byte
- func (b *FixedReader) CloneAvailable() *FixedReader
- func (b *FixedReader) Init(r io.Reader, buf *[]byte)
- func (b *FixedReader) IsInit() bool
- func (b *FixedReader) LeftMove()
- func (b *FixedReader) Len() int
- func (b *FixedReader) Read(p []byte) (n int, err error)
- func (b *FixedReader) ReadN(n int) (rvn int, err error)
- func (b *FixedReader) Release() error
- func (b *FixedReader) Reset(buf *[]byte)
- func (b *FixedReader) ResetReader(r io.Reader)
- func (b *FixedReader) WriteCap() int
- func (b *FixedReader) WriteCapBytes() []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FixedReader ¶
type FixedReader struct {
R, W int // buf read and write positions
// contains filtered or unexported fields
}
固定大小的FixedReader, 所有的内存都是提前分配好的 标准库的bufio.Reader不能自定义buf传过去, 导致控制力度会差点
func NewFixedReader ¶
func NewFixedReader(r io.Reader, buf *[]byte) *FixedReader
newBuffer returns a new Buffer whose buffer has the specified size.
func (*FixedReader) BufPtr ¶ added in v0.0.8
func (b *FixedReader) BufPtr() *[]byte
func (*FixedReader) Buffered ¶
func (b *FixedReader) Buffered() int
func (*FixedReader) Bytes ¶
func (b *FixedReader) Bytes() []byte
func (*FixedReader) CloneAvailable ¶
func (b *FixedReader) CloneAvailable() *FixedReader
func (*FixedReader) IsInit ¶ added in v0.0.8
func (b *FixedReader) IsInit() bool
func (*FixedReader) Read ¶
func (b *FixedReader) Read(p []byte) (n int, err error)
这和一般read接口中不一样 传入的p 一定会满足这个大小
func (*FixedReader) Release ¶
func (b *FixedReader) Release() error
func (*FixedReader) ResetReader ¶ added in v0.0.6
func (b *FixedReader) ResetReader(r io.Reader)