util

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2021 License: AGPL-3.0 Imports: 16 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BigEndian bigEndian

BigEndian is the big-endian implementation of ByteOrder.

View Source
var Crc32_Table = []uint32{}/* 256 elements not displayed */
View Source
var LittleEndian littleEndian

Functions

func BigLittleSwap

func BigLittleSwap(v uint) uint

func ByteToUint32

func ByteToUint32(data []byte, bigEndian bool) (ret uint32, err error)

千万注意大小端,RTMP是大端

func ByteToUint32N

func ByteToUint32N(data []byte) (ret uint32, err error)

// 千万注意大小端,RTMP是大端

func ByteToUint64N

func ByteToUint64N(data []byte) (ret uint64, err error)

// 千万注意大小端,RTMP是大端

func CurrentDir

func CurrentDir(path ...string) string

func Exist

func Exist(filename string) bool

检查文件或目录是否存在 如果由 filename 指定的文件或目录存在则返回 true,否则返回 false

func GetFillBytes

func GetFillBytes(data byte, n int) []byte

func GetPCR

func GetPCR(v uint64) uint64

func GetPtsDts

func GetPtsDts(v uint64) uint64

func GetUev

func GetUev(buff []byte, start int) (value int, pos int)

哥伦布解码

func PutPCR

func PutPCR(pcr uint64) uint64

func PutPtsDts

func PutPtsDts(v uint64) uint64

func ReadByteToUint16

func ReadByteToUint16(r io.Reader, bigEndian bool) (data uint16, err error)

func ReadByteToUint24

func ReadByteToUint24(r io.Reader, bigEndian bool) (data uint32, err error)

func ReadByteToUint32

func ReadByteToUint32(r io.Reader, bigEndian bool) (data uint32, err error)

func ReadByteToUint40

func ReadByteToUint40(r io.Reader, bigEndian bool) (data uint64, err error)

func ReadByteToUint48

func ReadByteToUint48(r io.Reader, bigEndian bool) (data uint64, err error)

func ReadByteToUint64

func ReadByteToUint64(r io.Reader, bigEndian bool) (data uint64, err error)

func ReadByteToUint8

func ReadByteToUint8(r io.Reader) (data uint8, err error)

func ReadFileLines

func ReadFileLines(filename string) (lines []string, err error)

func ToFloat64

func ToFloat64(num interface{}) float64

func Uint32ToByte

func Uint32ToByte(data uint32, bigEndian bool) (ret []byte, err error)

func WriteUint16ToByte

func WriteUint16ToByte(w io.Writer, data uint16, bigEndian bool) error

func WriteUint24ToByte

func WriteUint24ToByte(w io.Writer, data uint32, bigEndian bool) error

func WriteUint32ToByte

func WriteUint32ToByte(w io.Writer, data uint32, bigEndian bool) error

func WriteUint40ToByte

func WriteUint40ToByte(w io.Writer, data uint64, bigEndian bool) error

func WriteUint48ToByte

func WriteUint48ToByte(w io.Writer, data uint64, bigEndian bool) error

func WriteUint64ToByte

func WriteUint64ToByte(w io.Writer, data uint64, bigEndian bool) error

func WriteUint8ToByte

func WriteUint8ToByte(w io.Writer, data uint8) error

Types

type Crc32Reader

type Crc32Reader struct {
	R     io.Reader
	Crc32 uint32
}

func (*Crc32Reader) Read

func (cr *Crc32Reader) Read(b []byte) (n int, err error)

func (*Crc32Reader) ReadCrc32UIntAndCheck

func (cr *Crc32Reader) ReadCrc32UIntAndCheck() (err error)

type Crc32Writer

type Crc32Writer struct {
	W     io.Writer
	Crc32 uint32
}

func (*Crc32Writer) Write

func (wr *Crc32Writer) Write(b []byte) (n int, err error)

type IOVec

type IOVec struct {
	Data   [][]byte
	Length int
	// contains filtered or unexported fields
}

func (*IOVec) Append

func (iov *IOVec) Append(b []byte)

func (*IOVec) WriteTo

func (iov *IOVec) WriteTo(w io.Writer, n int) (written int, err error)

type IOVecWriter

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

func NewIOVecWriter

func NewIOVecWriter(w io.Writer) (iow *IOVecWriter)

func (*IOVecWriter) Flush

func (iow *IOVecWriter) Flush() error

func (*IOVecWriter) Write

func (iow *IOVecWriter) Write(data []byte) (written int, err error)

type SSE

type SSE struct {
	http.ResponseWriter
	context.Context
}

func NewSSE

func NewSSE(w http.ResponseWriter, ctx context.Context) *SSE

func (*SSE) Write

func (sse *SSE) Write(data []byte) (n int, err error)

func (*SSE) WriteEvent

func (sse *SSE) WriteEvent(event string, data []byte) (err error)

func (*SSE) WriteExec

func (sse *SSE) WriteExec(cmd *exec.Cmd) error

func (*SSE) WriteJSON

func (sse *SSE) WriteJSON(data interface{}) (err error)

type SysIOVec

type SysIOVec struct {
	Base   uintptr
	Length uint64
}

Directories

Path Synopsis
pio

Jump to

Keyboard shortcuts

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