Documentation ¶
Index ¶
- Variables
- func DecodeSize(totalSize int64, blockLen int64) int64
- func DecodeSizeWithDefualtBlock(size int64) int64
- func EncodeSize(size int64, blockLen int64) int64
- func EncodeSizeWithDefualtBlock(size int64) int64
- func NewBlockReader(r io.Reader, limit int64, block []byte) *blockReader
- func NewDecoderReader(in io.Reader) io.Readerdeprecated
- func NewEncoderReader(r io.Reader) io.Readerdeprecated
- func NewLimitEncoderReader(r io.Reader, limitSize int64) (enc *limitEncoderReader)
- func SetBlockSize(blockSize int64)
- type Decoder
- type Encoder
- type ReaderError
- type RequestBody
- type WriterError
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func DecodeSize ¶
func EncodeSize ¶
func NewDecoderReader
deprecated
func NewEncoderReader
deprecated
func NewLimitEncoderReader ¶
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
func NewDecoderWithBlock ¶
type ReaderError ¶
type ReaderError struct {
// contains filtered or unexported fields
}
type RequestBody ¶
type RequestBody interface { io.ReadCloser // CodeSize returns encoded whole body size for encoding, // or origin body size for decoding. CodeSize(int64) int64 }
RequestBody is implemented http request's body. always io.ReadCloser.
For client requests, The HTTP Client's Transport is responsible for calling the Close method. Necessarily call the Close method if the body's life-cycle control by yourself.
For server requests, the Server will close the request body. The ServeHTTP Handler does not need to.
The Body must allow Read to be called concurrently with Close. In particular, calling Close should unblock a Read waiting for input.
func NewBodyDecoder ¶
func NewBodyDecoder(rc io.ReadCloser) RequestBody
NewBodyDecoder returns decoder with crc32.
If rc == nil, the decoder is called just with CodeSize, you need not to Close it at all.
func NewBodyEncoder ¶
func NewBodyEncoder(rc io.ReadCloser) RequestBody
NewBodyEncoder returns encoder with crc32.
If rc == nil, the encoder is called just with CodeSize, you need not to Close it at all.
type WriterError ¶
type WriterError struct {
// contains filtered or unexported fields
}