util

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: Apache-2.0, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferStream

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

BufferStream a closable read/write stream of bytes backed by a slice

func NewBufferStream added in v1.8.0

func NewBufferStream(buf []byte) *BufferStream

NewBufferStream creates a new instance of BufferStream backed by the provided byte slice.

func (*BufferStream) Close

func (this *BufferStream) Close() error

Close makes the stream unavailable for further reads or writes.

func (*BufferStream) Len

func (this *BufferStream) Len() int

Len returns the size of the stream

func (*BufferStream) Offset

func (this *BufferStream) Offset() int

Offset returns the offset of the read pointer

func (*BufferStream) Read

func (this *BufferStream) Read(b []byte) (int, error)

Read returns an error if the stream is closed, otherwise reads data from the internal buffer at the read offset position. Returns the number of bytes read.

func (*BufferStream) SetOffset

func (this *BufferStream) SetOffset(off int) error

SetOffset sets the offset of the read pointer. Returns an error if the offset value is invalid otr the stream is closed.

func (*BufferStream) Write

func (this *BufferStream) Write(b []byte) (int, error)

Write returns an error if the stream is closed, otherwise writes the given data to the internal buffer (growing the buffer as needed). Returns the number of bytes written.

type LyndonWords

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

LyndonWords main structure used to decompose a string into Lyndon words

func NewLyndonWords

func NewLyndonWords() (*LyndonWords, error)

NewLyndonWords creates a new instance of LyndonWords

func (*LyndonWords) GetPositions

func (this *LyndonWords) GetPositions(s string) []int32

GetPositions reutrns the start index of each Lyndon word in the given string

func (*LyndonWords) Split

func (this *LyndonWords) Split(s string) []string

Split partitions the given sting into Lyndon words

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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