Documentation ¶
Index ¶
- func Bits8ToByte(bitArray []Bit) byte
- func BitsToByte(bitArray []Bit, bitLen int) byte
- func ByteArrayToIntArray(data []byte) (dataInts []int)
- func GetZeroBytes(zeroCount int) []byte
- func ImageToBase64Url(imageType Base64URLImageType, imageByte []byte) string
- func IntArrayToByteArray(data []int) (dataBytes []byte)
- func IntIn(target int, intArray []int) bool
- func IteratorStringByte(data string) <-chan rune
- func IteratorTwoByte(data string) <-chan uint16
- func IteratorTwoByteEach(data string) <-chan []uint16
- func Parallel(start, stop int, fn func(<-chan int))
- func RunCmd(command string, args ...string) (result string, err error)
- func StrIn(target string, strArray []string) bool
- type Base64URLImageType
- type Bit
- type DataStream
- func (ds *DataStream) AddBit(b []Bit, count int)
- func (ds *DataStream) AddIntBit(i int, count int)
- func (ds *DataStream) AddIntBit16(i uint16, count int)
- func (ds *DataStream) Clean()
- func (ds *DataStream) GetCount() int
- func (ds *DataStream) GetData() []Bit
- func (ds *DataStream) IteratorByte() <-chan byte
- type Module
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BitsToByte ¶
BitsToByte : convert bits to 1 byte
func ByteArrayToIntArray ¶
func GetZeroBytes ¶
GetZeroBytes :Get a zero byte array by zeroCount
func ImageToBase64Url ¶
func ImageToBase64Url(imageType Base64URLImageType, imageByte []byte) string
ImageToBase64Url : data:image/gif;base64, //gif data:image/png;base64, // png data:image/jpeg;base64,//jpeg data:image/svg+xml;base64 //svg
func IntArrayToByteArray ¶
IntArrayToByteArray :convert int array to byte array
func IteratorStringByte ¶
IteratorStringByte : iterate by rune
func IteratorTwoByte ¶
IteratorTwoByte : iterate by two-byte param: data,two-byte strings
func IteratorTwoByteEach ¶
Types ¶
type Base64URLImageType ¶
type Base64URLImageType string
const ( GifType Base64URLImageType = "gif" PngType Base64URLImageType = "png" JpegType Base64URLImageType = "jpeg" SvgType Base64URLImageType = "svg+xml" )
type Bit ¶
type Bit = byte
Bit : use byte to represent bit. value is 0/1
func ByteArrayTo8BitArray ¶
ByteArrayTo8BitArray :convert byte array to 8 bit array(1 byte split to 8 bit save in Bit array) e.g. : input : {byte(1)} result: {0,0,0,0,0,0,0,1}
func ByteArrayTo8BitArrayWithCount ¶
ByteArrayTo8BitArrayWithCount :convert byte array to 8 bit array(1 byte split to 8 bit save in Bit array) e.g. : input : {byte(1)} result: {0,0,0,0,0,0,0,1}
param data: input byte array param bitsCount: total bit count for return
func IntTo8BitArray ¶
IntTo8BitArray : int change to binary array in []byte, and byte is 8-bit
func IntToBinary ¶
IntToBinary : int change to binary array in []byte , array not full 8-bit
type DataStream ¶
type DataStream struct {
// contains filtered or unexported fields
}
func NewDataStream ¶
func NewDataStream(capacity int) *DataStream
func (*DataStream) AddBit ¶
func (ds *DataStream) AddBit(b []Bit, count int)
func (*DataStream) AddIntBit ¶
func (ds *DataStream) AddIntBit(i int, count int)
AddIntBit :Add int to []byte into DataStream
func (*DataStream) AddIntBit16 ¶
func (ds *DataStream) AddIntBit16(i uint16, count int)
AddIntBit16 :Add int to []byte into DataStream
func (*DataStream) Clean ¶
func (ds *DataStream) Clean()
func (*DataStream) GetCount ¶
func (ds *DataStream) GetCount() int
func (*DataStream) GetData ¶
func (ds *DataStream) GetData() []Bit
func (*DataStream) IteratorByte ¶
func (ds *DataStream) IteratorByte() <-chan byte
IteratorByte :Iterate the data bits to Byte(8-bit). return byte chan.