iokit

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Monitor = false

Functions

func Close added in v1.2.0

func Close(conn ...io.Closer)

func CloseAll added in v1.1.0

func CloseAll(connSlice ...net.Conn)

func CopyBuffer

func CopyBuffer(dst io.Writer, src io.Reader, bufLength int, block bool, monitor bool) (int64, error)

func CopyBufferBlock added in v1.1.0

func CopyBufferBlock(dst io.Writer, src io.Reader, monitor bool) (int64, error)

func CopyBufferCallBack added in v1.1.0

func CopyBufferCallBack(dst io.Writer, src io.Reader, bufLength int, block bool, intercept BinaryInterceptor) (total []byte, err error)

func CopyDuplex added in v1.2.0

func CopyDuplex(src io.ReadWriteCloser, dst io.ReadWriteCloser, thenClose bool) chan Direction

func DirectCopy

func DirectCopy(dst io.Writer, src io.Reader) (int64, error)

func ForceClose added in v1.2.0

func ForceClose(conn ...io.Closer)

func IsConnect added in v1.1.0

func IsConnect(conn net.Conn) bool

func NewConn added in v1.2.0

func NewConn(connFactory ConnFactoryFunc) (net.Conn, error)

func Read

func Read(rd io.Reader, b []byte) (int, error)

func ReadAllBytes

func ReadAllBytes(rd io.Reader) ([]byte, error)

func ReadAllBytesBuffer

func ReadAllBytesBuffer(rd io.Reader, bufLength int, block bool) ([]byte, error)

func ReadAllBytesNonBlocking added in v1.2.0

func ReadAllBytesNonBlocking(rd io.Reader) ([]byte, error)

func ReadAllString

func ReadAllString(rd io.Reader) (string, error)

func ReadCurrentFile

func ReadCurrentFile(relative string) ([]byte, error)

func ReadFile

func ReadFile(path string) ([]byte, error)

func ReadFileToBuf

func ReadFileToBuf(filePath string, bufSize int, receive func([]byte)) error

func ReadFirstLine

func ReadFirstLine(file string) (string, error)

func ReadLine

func ReadLine(rd io.Reader) (line []byte, err error)

func ReadLines

func ReadLines(rd io.Reader) ([][]byte, error)

func ReadToByte

func ReadToByte(rd io.Reader, delim byte) ([]byte, error)

func ReadToBytes

func ReadToBytes(rd io.Reader, delim []byte) ([]byte, error)

func ScanLine

func ScanLine(filePath string, handle func(string)) error

func SetDeadLine added in v1.2.0

func SetDeadLine(conn net.Conn, d time.Duration)

func Write

func Write(wr io.Writer, b []byte) (int, error)

func WriteString

func WriteString(wr io.Writer, s string) (int, error)

func WriteToCurrentFile

func WriteToCurrentFile(relative string, bytes []byte) error

func WriteToFile

func WriteToFile(bytes []byte, path string) error

Types

type BinaryInterceptor added in v1.1.0

type BinaryInterceptor func(...[]byte)

type ConnFactoryFunc added in v1.2.0

type ConnFactoryFunc func() (net.Conn, error)

type Direction added in v1.2.0

type Direction int
const (
	Upload   Direction = 0
	Download Direction = 1
)

Jump to

Keyboard shortcuts

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