split

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 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, nextSplit SplitIterator) (transport.StreamDialer, error)

NewStreamDialer creates a transport.StreamDialer that splits the outgoing stream according to nextSplit.

func NewWriter

func NewWriter(writer io.Writer, nextSegmentLength SplitIterator) io.Writer

NewWriter creates a split Writer that calls the nextSegmentLength SplitIterator to determine the number bytes until the next split point until it returns zero.

Types

type RepeatedSplit added in v0.0.18

type RepeatedSplit struct {
	Count int
	Bytes int64
}

RepeatedSplit represents a split sequence of count segments with bytes length.

type SplitIterator added in v0.0.18

type SplitIterator func() int64

SplitIterator is a function that returns how many bytes until the next split point, or zero if there are no more splits to do.

func NewFixedSplitIterator added in v0.0.18

func NewFixedSplitIterator(n int64) SplitIterator

NewFixedSplitIterator is a helper function that returns a SplitIterator that returns the input number once, followed by zero. This is helpful for when you want to split the stream once in a fixed position.

func NewRepeatedSplitIterator added in v0.0.18

func NewRepeatedSplitIterator(splits ...RepeatedSplit) SplitIterator

NewRepeatedSplitIterator is a helper function that returns a SplitIterator that returns split points according to splits. The splits input represents pairs of (count, bytes), meaning a sequence of count splits with bytes length. This is helpful for when you want to split the stream repeatedly at different positions and lengths.

Jump to

Keyboard shortcuts

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