Utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SZ_BYTE  int = 1
	SZ_SHORT int = 2
	SZ_INT   int = 4
	SZ_LONG  int = 8
)

Variables

This section is empty.

Functions

func GetStringLength

func GetStringLength(st string) int

func Substring

func Substring(s string, len int) string

Types

type ByteBuffer

type ByteBuffer struct {
	*bytes.Buffer
}

func NewBuffer

func NewBuffer(inp []byte) *ByteBuffer

NewBuffer create new buffer from preallocated buffer array

func (*ByteBuffer) GetHexDump

func (c *ByteBuffer) GetHexDump() string

GetHexDump get hex dump

func (*ByteBuffer) Read_Byte

func (c *ByteBuffer) Read_Byte() (b byte, ex *Exception.Exception)

Read_Byte read byte with checking error

func (*ByteBuffer) Read_Bytes

func (c *ByteBuffer) Read_Bytes(n int) (*ByteBuffer, *Exception.Exception)

ReadBytes read n byte with checking error

func (*ByteBuffer) Read_CString

func (c *ByteBuffer) Read_CString() (string, *Exception.Exception)

Read_CString read cstring with terminating zero

func (*ByteBuffer) Read_Int

func (c *ByteBuffer) Read_Int() (int32, *Exception.Exception)

Read_Int read int with checking error

func (*ByteBuffer) Read_Short

func (c *ByteBuffer) Read_Short() (int16, *Exception.Exception)

Read_Short read short with checking error

func (*ByteBuffer) Read_String

func (c *ByteBuffer) Read_String(size int) (string, *Exception.Exception)

Read_String read string with limited size

func (*ByteBuffer) Read_UnsafeByte

func (c *ByteBuffer) Read_UnsafeByte() byte

Read_UnsafeByte read byte without knowing about error

func (*ByteBuffer) Read_UnsafeInt

func (c *ByteBuffer) Read_UnsafeInt() int32

Read_UnsafeInt read short without knowing about error

func (*ByteBuffer) Read_UnsafeShort

func (c *ByteBuffer) Read_UnsafeShort() int16

Read_UnsafeShort read short without knowing about error

func (*ByteBuffer) Write_Buffer

func (c *ByteBuffer) Write_Buffer(d *ByteBuffer) *Exception.Exception

Write_Buffer append buffer

func (*ByteBuffer) Write_Byte

func (c *ByteBuffer) Write_Byte(data byte) *Exception.Exception

Write_Byte write a byte to buffer with checking error

func (*ByteBuffer) Write_Bytes

func (c *ByteBuffer) Write_Bytes(data []byte) *Exception.Exception

Write_Bytes write array of byte to buffer

func (*ByteBuffer) Write_CString

func (c *ByteBuffer) Write_CString(String string) *Exception.Exception

func (*ByteBuffer) Write_CStringWithEnc

func (c *ByteBuffer) Write_CStringWithEnc(String string, enc Data.Encoding) *Exception.Exception

func (*ByteBuffer) Write_Int

func (c *ByteBuffer) Write_Int(data int32) *Exception.Exception

Write_Int write int with checking error

func (*ByteBuffer) Write_Short

func (c *ByteBuffer) Write_Short(data int16) *Exception.Exception

Write_Short write short with checking error

func (*ByteBuffer) Write_String

func (c *ByteBuffer) Write_String(String string) *Exception.Exception

func (*ByteBuffer) Write_StringWithCount

func (c *ByteBuffer) Write_StringWithCount(String string, count int) *Exception.Exception

func (*ByteBuffer) Write_StringWithCountEnc

func (c *ByteBuffer) Write_StringWithCountEnc(String string, count int, enc Data.Encoding) *Exception.Exception

func (*ByteBuffer) Write_StringWithEnc

func (c *ByteBuffer) Write_StringWithEnc(String string, enc Data.Encoding) *Exception.Exception

func (*ByteBuffer) Write_UnsafeByte

func (c *ByteBuffer) Write_UnsafeByte(data byte)

Write_UnsafeByte write a byte to buffer without checking error

func (*ByteBuffer) Write_UnsafeInt

func (c *ByteBuffer) Write_UnsafeInt(data int32)

Write_UnsafeInt write int without checking error

func (*ByteBuffer) Write_UnsafeShort

func (c *ByteBuffer) Write_UnsafeShort(data int16)

Write_UnsafeShort write short without checking error

type Unprocessed

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

func NewUnprocessed

func NewUnprocessed() *Unprocessed

func (*Unprocessed) Check

func (c *Unprocessed) Check()

func (*Unprocessed) GetExpected

func (c *Unprocessed) GetExpected() int32

func (*Unprocessed) GetHasUnprocessed

func (c *Unprocessed) GetHasUnprocessed() bool

func (*Unprocessed) GetLastTimeReceived

func (c *Unprocessed) GetLastTimeReceived() int64

func (*Unprocessed) GetUnprocessed

func (c *Unprocessed) GetUnprocessed() *ByteBuffer

func (*Unprocessed) Reset

func (c *Unprocessed) Reset()

func (*Unprocessed) SetExpected

func (c *Unprocessed) SetExpected(value int32)

func (*Unprocessed) SetHasUnprocessed

func (c *Unprocessed) SetHasUnprocessed(value bool)

func (*Unprocessed) SetLastTimeReceived

func (c *Unprocessed) SetLastTimeReceived(value int64)

func (*Unprocessed) SetLastTimeReceivedCurTime

func (c *Unprocessed) SetLastTimeReceivedCurTime()

Jump to

Keyboard shortcuts

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