stream

package module
v0.0.0-...-98fa19b Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 36 Imported by: 8

Documentation

Index

Constants

View Source
const TimeLayout = "2006-01-02 15:04:05"

Variables

View Source
var (
	RegexpIp     = regexp.MustCompile(`((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))`) // todo panic
	RegexpIpPort = regexp.MustCompile(`((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d))):([0-9]+)`)
)
View Source
var RegexpCenter = `(.+?)`

Functions

func AlignString

func AlignString(s string, length int) (ss string)

func ApplyFill

func ApplyFill(c *Config, sv *svg.SVG) error

ApplyFill applies [Config.Fill] to the given svg.SVG.

func Atoi

func Atoi(s string) int

func BaseName

func BaseName(path string) string

func Concat

func Concat[S ~[]E, E any](slices_ ...S) S

func CopyDir

func CopyDir(source, destination string) (ok bool)

func CreatDirectory

func CreatDirectory(dir string) bool

func CurrentDirName

func CurrentDirName(path string) (currentDirName string)

func CutUint16

func CutUint16(u uint16) uint8

func EmbedImage

func EmbedImage(c *Config) error

EmbedImage embeds the input image file into the output svg file.

func FileExists

func FileExists(path string) bool

func FixUncPath

func FixUncPath(path string) string

func Float64Cut

func Float64Cut(value float64, bits int) (float64, error)

func Float64ToString

func Float64ToString(f float64, prec int) string

func FormatDuration

func FormatDuration(d time.Duration) string

func FormatTime

func FormatTime(t time.Time) string

func Gbk2Utf8

func Gbk2Utf8(gbk string) (utf8 string)

func GenXiLa26

func GenXiLa26() (letters []string)

GenXiLa26 生成26个希腊字母

func GenerateRandomNumber

func GenerateRandomNumber(max int) int

func GetDiffDays

func GetDiffDays(dstTime string) string

func GetPackageName

func GetPackageName() (pkgName string)

func GetTimeNowString

func GetTimeNowString() string

func GetTimeStamp

func GetTimeStamp() string

func GetTimeStamp13Bits

func GetTimeStamp13Bits() int64

func GetUserConfigDirs

func GetUserConfigDirs() (UserConfigDirs map[string]string, err error)

func GitProxy

func GitProxy(isSetProxy bool) bool

func HomeDir

func HomeDir() string

func Ico2Png

func Ico2Png(path string)

func Ico2PngAll

func Ico2PngAll(dir string)

Ico2PngAll github.com/smirkcat/ico

func IntegerToIP

func IntegerToIP(ip int64) string

func IsAndroid

func IsAndroid() bool

func IsDir

func IsDir(path string) bool

func IsDirDeep1

func IsDirDeep1(path string) bool

IsDirDeep1 是否是一级目录,包含目录分隔符的深度一定大于1

func IsLinux

func IsLinux() bool

func IsTermux

func IsTermux() bool

func IsWindows

func IsWindows() bool

func IsZero

func IsZero(v reflect.Value) bool

func JoinHomeDir

func JoinHomeDir(path string) (join string, ok bool)

func JoinHomeFile

func JoinHomeFile(path string) (join string, ok bool)

func Lines

func Lines(x []byte) []string

Lines returns the lines in the file x, including newlines. If the file does not end in a newline, one is supplied along with a warning about the missing newline.

func MoveFile

func MoveFile(src, dst string) (err error)

func NewVersion

func NewVersion[T string | uint64](s ...T) (v *object)

func ParseFloat

func ParseFloat(s string) float64

func ParseInt

func ParseInt(s string) int64

func ParseUint

func ParseUint(s string) uint64

func Png2Svg

func Png2Svg(path string)

func Png2SvgAll

func Png2SvgAll(dir string)

func RandomNum

func RandomNum(min, max int) int

func ReadFileAndWriteTruncate

func ReadFileAndWriteTruncate(path, dstPath string) (ok bool)

func ReadFileSubTimeWithCallBack

func ReadFileSubTimeWithCallBack(title, path string, callBack func(string))

func ReadFileToLines

func ReadFileToLines(path string) (lines []string, ok bool)

func ReaderGzip

func ReaderGzip[T safeType.Type](data T) *safeType.Data

func RegexpWebBodyBlocks

func RegexpWebBodyBlocks(tagName string) string

func Render

func Render(c *Config) error

Render renders the input svg file to the output image file.

func RunDir

func RunDir() string

func RunDirAbs

func RunDirAbs() string

func SetNameAndEmail

func SetNameAndEmail(s *Stream)

func SetProxy

func SetProxy(s *Stream, isSetProxy bool)

func SetSafecrlf

func SetSafecrlf(s *Stream)

func SlicesIndex

func SlicesIndex(slice any, item any) int

func SlicesInsert

func SlicesInsert(slice any, index int, value any) any

func SplitFileByLines

func SplitFileByLines(filePath string, size int)

SplitFileByLines 按行数切割文件

func SubStrRunes

func SubStrRunes(s string, length int) string

func SwapBytes

func SwapBytes(src []byte) (dst []byte)

func SwapBytes2HexString

func SwapBytes2HexString(src []byte) (dst safeType.HexString)

func SwapBytes2HexString2

func SwapBytes2HexString2(src safeType.HexString) (dst string)

SwapBytes2HexString2 逆序,并不是交换 todo 重命名为 Reverse,如果输入参数复合8字节以下的字节对齐可以用二进制包,不过不通用

func ToCamel

func ToCamel(data string, isCommit bool) string

func ToCamelToLower

func ToCamelToLower(s string, isCommit bool) string

func ToCamelUpper

func ToCamelUpper(s string, isCommit bool) string

func TrimExtension

func TrimExtension(path string) string

func UnFormatDuration

func UnFormatDuration(s string) time.Duration

func UnFormatTime

func UnFormatTime(s string) time.Time

func Utf82Gbk

func Utf82Gbk(utf8 string) (gbk string)

func WriteAppend

func WriteAppend[T safeType.Type](name string, data T) bool

func WriteBinaryFile

func WriteBinaryFile[T safeType.Type](name string, data T) bool

func WriteGoFile

func WriteGoFile[T safeType.Type](name string, data T) (ok bool)

func WriteTruncate

func WriteTruncate[T safeType.Type](name string, data T) bool

Types

type Config

type Config struct {
	// Input is the filename of the input file
	Input string `posarg:"0"`

	// Output is the filename of the output file.
	// Defaults to input with the extension changed to the output format.
	Output string `flag:"o,output"`

	// Fill, if specified, indicates to fill the background of
	// the svg with the specified color in CSS format.
	Fill string

	Render RenderConfig `cmd:"render"`
}

type RenderConfig

type RenderConfig struct {
	// Width is the width of the rendered image
	Width int `posarg:"1"`

	// Height is the height of the rendered image.
	// Defaults to width.
	Height int `posarg:"2" required:"-"`
}

type Stream

type Stream struct{ *safeType.Data }

func New

func New[T safeType.Type](data T) *Stream

func NewBinaryType

func NewBinaryType[T safeType.BinaryType](b T) *Stream

func NewHexDump

func NewHexDump(h safeType.HexDumpString) *Stream

func NewHexString

func NewHexString(s safeType.HexString) *Stream

func NewReadFile

func NewReadFile(path string) *Stream

func (*Stream) AppendByteSlice

func (o *Stream) AppendByteSlice(bytesSlice ...[]byte) []byte

func (*Stream) BigNumXorWithAlign

func (o *Stream) BigNumXorWithAlign(arg1, arg2 []byte, align int) (xorStream []byte)

func (*Stream) CheckDesBlockSize

func (o *Stream) CheckDesBlockSize() bool

func (*Stream) Contains

func (o *Stream) Contains(substr string) bool

func (*Stream) CutString

func (o *Stream) CutString(left, right string) (cut string, found bool)

func (*Stream) CutUint16

func (o *Stream) CutUint16(u uint16) uint8

func (*Stream) CutWithIndex

func (o *Stream) CutWithIndex(x, y int) []byte

func (*Stream) Indent

func (o *Stream) Indent(deep int)

func (*Stream) InsertByte

func (o *Stream) InsertByte(index int, ch byte)

func (*Stream) InsertBytes

func (o *Stream) InsertBytes(index int, insert []byte) []byte

func (*Stream) InsertRune

func (o *Stream) InsertRune(index int, r rune)

func (*Stream) InsertString

func (o *Stream) InsertString(index int, s string) string

func (*Stream) InsertStringWithSplit

func (o *Stream) InsertStringWithSplit(size int, insert string) string

func (*Stream) JsonIndent

func (o *Stream) JsonIndent() string

func (*Stream) LinesToString

func (o *Stream) LinesToString(lines []string) string

func (*Stream) MergeByte

func (o *Stream) MergeByte(streams ...[]byte) []byte

func (*Stream) NewLine

func (o *Stream) NewLine() *Stream

func (*Stream) ObjectBegin

func (o *Stream) ObjectBegin()

func (*Stream) ObjectEnd

func (o *Stream) ObjectEnd()

func (*Stream) Quote

func (o *Stream) Quote()

func (*Stream) QuoteWith

func (o *Stream) QuoteWith(s string) *Stream

func (*Stream) ReadBinary

func (o *Stream) ReadBinary(order binary.ByteOrder) (data any)

func (*Stream) ReaderGzip

func (o *Stream) ReaderGzip() *Stream

func (*Stream) ReplaceAll

func (o *Stream) ReplaceAll(old, new string) *Stream

func (*Stream) SerialNumber

func (o *Stream) SerialNumber() string

SerialNumber 这个才是swap功能,前后字节交换顺序

func (*Stream) SliceBegin

func (o *Stream) SliceBegin()

func (*Stream) SliceEnd

func (o *Stream) SliceEnd()

func (*Stream) SplitBytes

func (o *Stream) SplitBytes(size int) (blocks [][]byte)

func (*Stream) SplitString

func (o *Stream) SplitString(size int) (blocks []string)

func (*Stream) ToLines

func (o *Stream) ToLines() (lines []string, ok bool)

func (*Stream) WriteBinary

func (o *Stream) WriteBinary(order binary.ByteOrder, data any) bool

func (*Stream) WriteBytesLn

func (o *Stream) WriteBytesLn(b []byte) *Stream

func (*Stream) WritePackageName

func (o *Stream) WritePackageName()

func (*Stream) WriteStringLn

func (o *Stream) WriteStringLn(s string) *Stream

Directories

Path Synopsis
net
httpClient
<nilaway struct enable>
<nilaway struct enable>
script
desktop
Package desktop provides desktop integration utilities.
Package desktop provides desktop integration utilities.
errs
Package errs implements a detailed error object that provides stack traces with source locations, along with nested causes, if any.
Package errs implements a detailed error object that provides stack traces with source locations, along with nested causes, if any.
taskqueue
Package taskqueue provides a simple asynchronous task queue.
Package taskqueue provides a simple asynchronous task queue.
txt
Package txt provides various text utilities.
Package txt provides various text utilities.
tui

Jump to

Keyboard shortcuts

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