split

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStreamDialer

func NewStreamDialer(dialer transport.StreamDialer, prefixBytes int64) (transport.StreamDialer, error)

NewStreamDialer creates a transport.StreamDialer that splits the outgoing stream after writing "prefixBytes" bytes using SplitWriter.

Types

type SplitWriter

type SplitWriter struct {
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(writer io.Writer, prefixBytes int64) *SplitWriter

NewWriter creates a io.Writer that ensures the byte sequence is split at prefixBytes, meaning a write will end right after byte index prefixBytes - 1, before a write starting at byte index prefixBytes. For example, if you have a write of [0123456789] and prefixBytes = 3, you will get writes [012] and [3456789].

func (*SplitWriter) ReadFrom

func (w *SplitWriter) ReadFrom(source io.Reader) (written int64, err error)

func (*SplitWriter) Write

func (w *SplitWriter) Write(data []byte) (written int, err error)

Jump to

Keyboard shortcuts

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