length

package
v1.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2022 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// FieldLength field length bytes
	FieldLength = 4

	// DefaultMaxBodySize max default body size, 10M
	DefaultMaxBodySize = 1024 * 1024 * 10
)

Variables

This section is empty.

Functions

func New

func New(baseEncoder codec.Encoder, baseDecoder codec.Decoder) (codec.Encoder, codec.Decoder)

New returns a default IntLengthFieldBased codec

func NewWithSize

func NewWithSize(baseEncoder codec.Encoder, baseDecoder codec.Decoder, lengthFieldOffset, lengthAdjustment, initialBytesToStrip, maxBodySize int) (codec.Encoder, codec.Decoder)

NewWithSize create IntLengthFieldBased codec initialBytesToStrip + lengthFieldOffset + 4(length) lengthAdjustment, some case as below: 1. 0 : base decoder received: body 2. -4: base decoder received: 4(length) + body 3. -(4 + lengthFieldOffset): base decoder received: lengthFieldOffset + 4(length) + body 4. -(4 + lengthFieldOffset + initialBytesToStrip): base decoder received: initialBytesToStrip + lengthFieldOffset + 4(length)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL