Documentation
¶
Index ¶
- type ReadSeeker
- func (r *ReadSeeker) Close()
- func (r *ReadSeeker) Contains(sep []byte) bool
- func (r *ReadSeeker) Count(sep []byte) int64
- func (r *ReadSeeker) CountGen(beginPos, endPos int64, sep []byte) int64
- func (r *ReadSeeker) CurPos() (int64, error)
- func (r *ReadSeeker) Index(sep []byte) int64
- func (r *ReadSeeker) IndexGen(beginPos, endPos int64, sep []byte) int64
- func (r *ReadSeeker) IndexN(beginPos int64, sep []byte, n int) int64
- func (r *ReadSeeker) LastIndex(sep []byte) int64
- func (r *ReadSeeker) LastIndexGen(beginPos, endPos int64, sep []byte) int64
- func (r *ReadSeeker) LenUnRead() int64
- func (r *ReadSeeker) Move(n int64) error
- func (r *ReadSeeker) MoveTo(pos int64) error
- func (r *ReadSeeker) ReadBytes(n int) ([]byte, error)
- func (r *ReadSeeker) ReadBytesReverse(n int) ([]byte, error)
- func (r *ReadSeeker) ReadBytesUint8() ([]byte, error)
- func (r *ReadSeeker) ReadBytesUint16() ([]byte, error)
- func (r *ReadSeeker) ReadBytesUint16BigEndian() ([]byte, error)
- func (r *ReadSeeker) ReadBytesUint32() ([]byte, error)
- func (r *ReadSeeker) ReadBytesUint32BigEndian() ([]byte, error)
- func (r *ReadSeeker) ReadBytesUint64() ([]byte, error)
- func (r *ReadSeeker) ReadBytesUint64BigEndian() ([]byte, error)
- func (r *ReadSeeker) ReadBytesUnRead() ([]byte, error)
- func (r *ReadSeeker) ReadFloat32() (float32, error)
- func (r *ReadSeeker) ReadFloat32BigEndian() (float32, error)
- func (r *ReadSeeker) ReadFloat64() (float64, error)
- func (r *ReadSeeker) ReadFloat64BigEndian() (float64, error)
- func (r *ReadSeeker) ReadHexToString(n int) (string, error)
- func (r *ReadSeeker) ReadInt8() (int8, error)
- func (r *ReadSeeker) ReadInt16() (int16, error)
- func (r *ReadSeeker) ReadInt16BigEndian() (int16, error)
- func (r *ReadSeeker) ReadInt32() (int32, error)
- func (r *ReadSeeker) ReadInt32BigEndian() (int32, error)
- func (r *ReadSeeker) ReadInt64() (int64, error)
- func (r *ReadSeeker) ReadInt64BigEndian() (int64, error)
- func (r *ReadSeeker) ReadString(n int) (string, error)
- func (r *ReadSeeker) ReadStringTrimSpace(n int) (string, error)
- func (r *ReadSeeker) ReadStringUint8() (string, error)
- func (r *ReadSeeker) ReadStringUint16() (string, error)
- func (r *ReadSeeker) ReadStringUint16BigEndian() (string, error)
- func (r *ReadSeeker) ReadStringUint32() (string, error)
- func (r *ReadSeeker) ReadStringUint32BigEndian() (string, error)
- func (r *ReadSeeker) ReadStringUint64() (string, error)
- func (r *ReadSeeker) ReadStringUint64BigEndian() (string, error)
- func (r *ReadSeeker) ReadStringUnRead() (string, error)
- func (r *ReadSeeker) ReadUint8() (uint8, error)
- func (r *ReadSeeker) ReadUint16() (uint16, error)
- func (r *ReadSeeker) ReadUint16BigEndian() (uint16, error)
- func (r *ReadSeeker) ReadUint32() (uint32, error)
- func (r *ReadSeeker) ReadUint32BigEndian() (uint32, error)
- func (r *ReadSeeker) ReadUint64() (uint64, error)
- func (r *ReadSeeker) ReadUint64BigEndian() (uint64, error)
- func (r *ReadSeeker) Size() int64
- type Writer
- func (w *Writer) Bytes() []byte
- func (w *Writer) Reset()
- func (w *Writer) WriteBytes(p []byte)
- func (w *Writer) WriteBytesUint8(p []byte)
- func (w *Writer) WriteBytesUint16(p []byte)
- func (w *Writer) WriteBytesUint16BigEndian(p []byte)
- func (w *Writer) WriteBytesUint32(p []byte)
- func (w *Writer) WriteBytesUint32BigEndian(p []byte)
- func (w *Writer) WriteBytesUint64(p []byte)
- func (w *Writer) WriteBytesUint64BigEndian(p []byte)
- func (w *Writer) WriteFloat32(i float32)
- func (w *Writer) WriteFloat32BigEndian(i float32)
- func (w *Writer) WriteFloat64(i float64)
- func (w *Writer) WriteFloat64BigEndian(i float64)
- func (w *Writer) WriteInt8(i int8)
- func (w *Writer) WriteInt16(i int16)
- func (w *Writer) WriteInt16BigEndian(i int16)
- func (w *Writer) WriteInt32(i int32)
- func (w *Writer) WriteInt32BigEndian(i int32)
- func (w *Writer) WriteInt64(i int64)
- func (w *Writer) WriteInt64BigEndian(i int64)
- func (w *Writer) WriteString(s string)
- func (w *Writer) WriteStringUint8(s string)
- func (w *Writer) WriteStringUint16(s string)
- func (w *Writer) WriteStringUint16BigEndian(s string)
- func (w *Writer) WriteStringUint32(s string)
- func (w *Writer) WriteStringUint32BigEndian(s string)
- func (w *Writer) WriteStringUint64(s string)
- func (w *Writer) WriteStringUint64BigEndian(s string)
- func (w *Writer) WriteUint8(i uint8)
- func (w *Writer) WriteUint16(i uint16)
- func (w *Writer) WriteUint16BigEndian(i uint16)
- func (w *Writer) WriteUint32(i uint32)
- func (w *Writer) WriteUint32BigEndian(i uint32)
- func (w *Writer) WriteUint64(i uint64)
- func (w *Writer) WriteUint64BigEndian(i uint64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReadSeeker ¶
type ReadSeeker struct {
// contains filtered or unexported fields
}
ReadSeeker helps you read and seek data from io.ReadSeeker,the default ByteOrder is LittleEndian.
func NewReadSeeker ¶
func NewReadSeeker(rs io.ReadSeeker) *ReadSeeker
returns a *ReadSeeker from io.ReadSeeker.
func NewReadSeekerFromBytes ¶
func NewReadSeekerFromBytes(b []byte) *ReadSeeker
returns a *ReadSeeker from bytes.
func NewReadSeekerFromFile ¶
func NewReadSeekerFromFile(fileName string) (*ReadSeeker, error)
returns a *ReadSeeker from file.
func (*ReadSeeker) Contains ¶
func (r *ReadSeeker) Contains(sep []byte) bool
Contains reports whether sep is within the data.
func (*ReadSeeker) Count ¶
func (r *ReadSeeker) Count(sep []byte) int64
Count counts the number of non-overlapping instances of sep in data.
func (*ReadSeeker) CountGen ¶
func (r *ReadSeeker) CountGen(beginPos, endPos int64, sep []byte) int64
Count counts the number of non-overlapping instances of sep in a range of data.
func (*ReadSeeker) Index ¶
func (r *ReadSeeker) Index(sep []byte) int64
Index returns the index of the first instance of substr in data.
func (*ReadSeeker) IndexGen ¶
func (r *ReadSeeker) IndexGen(beginPos, endPos int64, sep []byte) int64
Index returns the index of the first instance of substr in a range of data.
func (*ReadSeeker) IndexN ¶
func (r *ReadSeeker) IndexN(beginPos int64, sep []byte, n int) int64
Index returns the nth index of the instance of sep in data.
func (*ReadSeeker) LastIndex ¶
func (r *ReadSeeker) LastIndex(sep []byte) int64
LastIndex returns the index of the last instance of sep in data.
func (*ReadSeeker) LastIndexGen ¶
func (r *ReadSeeker) LastIndexGen(beginPos, endPos int64, sep []byte) int64
LastIndex returns the index of the last instance of sep in a range of data.
func (*ReadSeeker) LenUnRead ¶
func (r *ReadSeeker) LenUnRead() int64
get the length of unread data.
func (*ReadSeeker) Move ¶
func (r *ReadSeeker) Move(n int64) error
Seeking to an offset before the SeekCurrent of the file.
func (*ReadSeeker) MoveTo ¶
func (r *ReadSeeker) MoveTo(pos int64) error
Seeking to an offset before the start of the file.
func (*ReadSeeker) ReadBytesReverse ¶
func (r *ReadSeeker) ReadBytesReverse(n int) ([]byte, error)
read n bytes,read the data backwards.
func (*ReadSeeker) ReadBytesUint8 ¶
func (r *ReadSeeker) ReadBytesUint8() ([]byte, error)
read uint8 as the data length and then read the data.
func (*ReadSeeker) ReadBytesUint16 ¶
func (r *ReadSeeker) ReadBytesUint16() ([]byte, error)
read uint16 as the data length and then read the data.
func (*ReadSeeker) ReadBytesUint16BigEndian ¶
func (r *ReadSeeker) ReadBytesUint16BigEndian() ([]byte, error)
read uint16(BigEndian) as the data length and then read the data.
func (*ReadSeeker) ReadBytesUint32 ¶
func (r *ReadSeeker) ReadBytesUint32() ([]byte, error)
read uint32 as the data length and then read the data.
func (*ReadSeeker) ReadBytesUint32BigEndian ¶
func (r *ReadSeeker) ReadBytesUint32BigEndian() ([]byte, error)
read uint32(BigEndian) as the data length and then read the data.
func (*ReadSeeker) ReadBytesUint64 ¶
func (r *ReadSeeker) ReadBytesUint64() ([]byte, error)
read uint64 as the data length and then read the data.
func (*ReadSeeker) ReadBytesUint64BigEndian ¶
func (r *ReadSeeker) ReadBytesUint64BigEndian() ([]byte, error)
read uint64(BigEndian) as the data length and then read the data.
func (*ReadSeeker) ReadBytesUnRead ¶
func (r *ReadSeeker) ReadBytesUnRead() ([]byte, error)
get all unread data.
func (*ReadSeeker) ReadFloat32 ¶
func (r *ReadSeeker) ReadFloat32() (float32, error)
read 4 bytes and convert it to float32.
func (*ReadSeeker) ReadFloat32BigEndian ¶
func (r *ReadSeeker) ReadFloat32BigEndian() (float32, error)
read 4 bytes and convert it to float32(BigEndian).
func (*ReadSeeker) ReadFloat64 ¶
func (r *ReadSeeker) ReadFloat64() (float64, error)
read 8 bytes and convert it to float64.
func (*ReadSeeker) ReadFloat64BigEndian ¶
func (r *ReadSeeker) ReadFloat64BigEndian() (float64, error)
read 8 bytes and convert it to float64(BigEndian).
func (*ReadSeeker) ReadHexToString ¶
func (r *ReadSeeker) ReadHexToString(n int) (string, error)
read n bytes of the data and then returns the hexadecimal encoding of the bytes.
func (*ReadSeeker) ReadInt8 ¶
func (r *ReadSeeker) ReadInt8() (int8, error)
read 1 byte and then convert to int8.
func (*ReadSeeker) ReadInt16 ¶
func (r *ReadSeeker) ReadInt16() (int16, error)
read 2 bytes and then convert to int16.
func (*ReadSeeker) ReadInt16BigEndian ¶
func (r *ReadSeeker) ReadInt16BigEndian() (int16, error)
read 2 bytes and then convert to int16(BigEndian).
func (*ReadSeeker) ReadInt32 ¶
func (r *ReadSeeker) ReadInt32() (int32, error)
read 4 bytes and then convert to int32.
func (*ReadSeeker) ReadInt32BigEndian ¶
func (r *ReadSeeker) ReadInt32BigEndian() (int32, error)
read 4 bytes and then convert to int32(BigEndian).
func (*ReadSeeker) ReadInt64 ¶
func (r *ReadSeeker) ReadInt64() (int64, error)
read 8 bytes and then convert to int64.
func (*ReadSeeker) ReadInt64BigEndian ¶
func (r *ReadSeeker) ReadInt64BigEndian() (int64, error)
read 8 bytes and then convert to int64(BigEndian).
func (*ReadSeeker) ReadString ¶
func (r *ReadSeeker) ReadString(n int) (string, error)
read n bytes of the data and convert to string.
func (*ReadSeeker) ReadStringTrimSpace ¶
func (r *ReadSeeker) ReadStringTrimSpace(n int) (string, error)
read n bytes of data, then convert to string, and then remove spaces in the string.
func (*ReadSeeker) ReadStringUint8 ¶
func (r *ReadSeeker) ReadStringUint8() (string, error)
read uint8 as the data length and then read the data.
func (*ReadSeeker) ReadStringUint16 ¶
func (r *ReadSeeker) ReadStringUint16() (string, error)
read uint16 as the data length and then read the data.
func (*ReadSeeker) ReadStringUint16BigEndian ¶
func (r *ReadSeeker) ReadStringUint16BigEndian() (string, error)
read uint16(BigEndian) as the data length and then read the data.
func (*ReadSeeker) ReadStringUint32 ¶
func (r *ReadSeeker) ReadStringUint32() (string, error)
read uint32 as the data length and then read the data.
func (*ReadSeeker) ReadStringUint32BigEndian ¶
func (r *ReadSeeker) ReadStringUint32BigEndian() (string, error)
read uint32(BigEndian) as the data length and then read the data.
func (*ReadSeeker) ReadStringUint64 ¶
func (r *ReadSeeker) ReadStringUint64() (string, error)
read uint64 as the data length and then read the data.
func (*ReadSeeker) ReadStringUint64BigEndian ¶
func (r *ReadSeeker) ReadStringUint64BigEndian() (string, error)
read uint64(BigEndian) as the data length and then read the data.
func (*ReadSeeker) ReadStringUnRead ¶
func (r *ReadSeeker) ReadStringUnRead() (string, error)
read all unread data and convert to string.
func (*ReadSeeker) ReadUint8 ¶
func (r *ReadSeeker) ReadUint8() (uint8, error)
read 1 byte and then convert to uint8.
func (*ReadSeeker) ReadUint16 ¶
func (r *ReadSeeker) ReadUint16() (uint16, error)
read 2 bytes and then convert to uint16.
func (*ReadSeeker) ReadUint16BigEndian ¶
func (r *ReadSeeker) ReadUint16BigEndian() (uint16, error)
read 2 bytes and then convert to uint16(BigEndian).
func (*ReadSeeker) ReadUint32 ¶
func (r *ReadSeeker) ReadUint32() (uint32, error)
read 4 bytes and then convert to uint32.
func (*ReadSeeker) ReadUint32BigEndian ¶
func (r *ReadSeeker) ReadUint32BigEndian() (uint32, error)
read 4 bytes and then convert to uint32(BigEndian).
func (*ReadSeeker) ReadUint64 ¶
func (r *ReadSeeker) ReadUint64() (uint64, error)
read 8 bytes and then convert to uint64.
func (*ReadSeeker) ReadUint64BigEndian ¶
func (r *ReadSeeker) ReadUint64BigEndian() (uint64, error)
read 8 bytes and then convert to uint64(BigEndian).
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer helps you write data into an bytes.Buffer. the default ByteOrder is LittleEndian.
func NewBytesBuffer ¶
NewBytesBuffer returns a *Writer.
func (*Writer) WriteBytesUint8 ¶
Write the length(Uint8) of the byte first, then write the byte.
func (*Writer) WriteBytesUint16 ¶
Write the length(Uint16) of the byte first, then write the byte.
func (*Writer) WriteBytesUint16BigEndian ¶
Write the length(Uint16 BigEndian) of the byte first, then write the byte.
func (*Writer) WriteBytesUint32 ¶
Write the length(Uint32) of the byte first, then write the byte.
func (*Writer) WriteBytesUint32BigEndian ¶
Write the length(Uint32 BigEndian) of the byte first, then write the byte.
func (*Writer) WriteBytesUint64 ¶
Write the length(Uint16) of the byte first, then write the byte.
func (*Writer) WriteBytesUint64BigEndian ¶
Write the length(Uint16) of the byte first, then write the byte.
func (*Writer) WriteFloat32 ¶
Write float32 with LittleEndian into Writer.
func (*Writer) WriteFloat32BigEndian ¶
Write float32 with BigEndian into Writer.
func (*Writer) WriteFloat64 ¶
Write float64 with LittleEndian into Writer.
func (*Writer) WriteFloat64BigEndian ¶
Write float64 with BigEndian into Writer.
func (*Writer) WriteInt16 ¶
Write int16 with LittleEndian into Writer.
func (*Writer) WriteInt16BigEndian ¶
Write int16 with BigEndian into Writer.
func (*Writer) WriteInt32 ¶
Write int32 with LittleEndian into Writer.
func (*Writer) WriteInt32BigEndian ¶
Write int32 with BigEndian into Writer.
func (*Writer) WriteInt64 ¶
Write int64 with LittleEndian into Writer.
func (*Writer) WriteInt64BigEndian ¶
Write int64 with BigEndian into Writer.
func (*Writer) WriteStringUint8 ¶
Write the length(Uint8) of the string first, then write the string.
func (*Writer) WriteStringUint16 ¶
Write the length(Uint16) of the string first, then write the string.
func (*Writer) WriteStringUint16BigEndian ¶
Write the length(Uint16 BigEndian) of the string first, then write the string.
func (*Writer) WriteStringUint32 ¶
Write the length(Uint32) of the string first, then write the string.
func (*Writer) WriteStringUint32BigEndian ¶
Write the length(Uint32 BigEndian) of the string first, then write the string.
func (*Writer) WriteStringUint64 ¶
Write the length(Uint16) of the string first, then write the string.
func (*Writer) WriteStringUint64BigEndian ¶
Write the length(Uint16) of the string first, then write the string.
func (*Writer) WriteUint16 ¶
Write uint16 with LittleEndian into Writer.
func (*Writer) WriteUint16BigEndian ¶
Write uint16 with BigEndian into Writer.
func (*Writer) WriteUint32 ¶
Write uint32 with LittleEndian into Writer.
func (*Writer) WriteUint32BigEndian ¶
Write uint32 with BigEndian into Writer.
func (*Writer) WriteUint64 ¶
Write uint64 with LittleEndian into Writer.
func (*Writer) WriteUint64BigEndian ¶
Write uint64 with BigEndian into Writer.