iox

package module
v0.0.0-...-2a3f794 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 10 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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) Close

func (r *ReadSeeker) Close()

Close if it's a io.Closer.

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) CurPos

func (r *ReadSeeker) CurPos() (int64, error)

get current pos of offset.

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) ReadBytes

func (r *ReadSeeker) ReadBytes(n int) ([]byte, error)

read n bytes.

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).

func (*ReadSeeker) Size

func (r *ReadSeeker) Size() int64

get the size of the data.

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

func NewBytesBuffer(buf ...bytes.Buffer) *Writer

NewBytesBuffer returns a *Writer.

func (*Writer) Bytes

func (w *Writer) Bytes() []byte

when write finished get the data from the bytes.Buffer.

func (*Writer) Reset

func (w *Writer) Reset()

resets the buffer to be empty.

func (*Writer) WriteBytes

func (w *Writer) WriteBytes(p []byte)

Write Byte into writer.

func (*Writer) WriteBytesUint8

func (w *Writer) WriteBytesUint8(p []byte)

Write the length(Uint8) of the byte first, then write the byte.

func (*Writer) WriteBytesUint16

func (w *Writer) WriteBytesUint16(p []byte)

Write the length(Uint16) of the byte first, then write the byte.

func (*Writer) WriteBytesUint16BigEndian

func (w *Writer) WriteBytesUint16BigEndian(p []byte)

Write the length(Uint16 BigEndian) of the byte first, then write the byte.

func (*Writer) WriteBytesUint32

func (w *Writer) WriteBytesUint32(p []byte)

Write the length(Uint32) of the byte first, then write the byte.

func (*Writer) WriteBytesUint32BigEndian

func (w *Writer) WriteBytesUint32BigEndian(p []byte)

Write the length(Uint32 BigEndian) of the byte first, then write the byte.

func (*Writer) WriteBytesUint64

func (w *Writer) WriteBytesUint64(p []byte)

Write the length(Uint16) of the byte first, then write the byte.

func (*Writer) WriteBytesUint64BigEndian

func (w *Writer) WriteBytesUint64BigEndian(p []byte)

Write the length(Uint16) of the byte first, then write the byte.

func (*Writer) WriteFloat32

func (w *Writer) WriteFloat32(i float32)

Write float32 with LittleEndian into Writer.

func (*Writer) WriteFloat32BigEndian

func (w *Writer) WriteFloat32BigEndian(i float32)

Write float32 with BigEndian into Writer.

func (*Writer) WriteFloat64

func (w *Writer) WriteFloat64(i float64)

Write float64 with LittleEndian into Writer.

func (*Writer) WriteFloat64BigEndian

func (w *Writer) WriteFloat64BigEndian(i float64)

Write float64 with BigEndian into Writer.

func (*Writer) WriteInt8

func (w *Writer) WriteInt8(i int8)

Write int8 into Writer.

func (*Writer) WriteInt16

func (w *Writer) WriteInt16(i int16)

Write int16 with LittleEndian into Writer.

func (*Writer) WriteInt16BigEndian

func (w *Writer) WriteInt16BigEndian(i int16)

Write int16 with BigEndian into Writer.

func (*Writer) WriteInt32

func (w *Writer) WriteInt32(i int32)

Write int32 with LittleEndian into Writer.

func (*Writer) WriteInt32BigEndian

func (w *Writer) WriteInt32BigEndian(i int32)

Write int32 with BigEndian into Writer.

func (*Writer) WriteInt64

func (w *Writer) WriteInt64(i int64)

Write int64 with LittleEndian into Writer.

func (*Writer) WriteInt64BigEndian

func (w *Writer) WriteInt64BigEndian(i int64)

Write int64 with BigEndian into Writer.

func (*Writer) WriteString

func (w *Writer) WriteString(s string)

Write String into writer

func (*Writer) WriteStringUint8

func (w *Writer) WriteStringUint8(s string)

Write the length(Uint8) of the string first, then write the string.

func (*Writer) WriteStringUint16

func (w *Writer) WriteStringUint16(s string)

Write the length(Uint16) of the string first, then write the string.

func (*Writer) WriteStringUint16BigEndian

func (w *Writer) WriteStringUint16BigEndian(s string)

Write the length(Uint16 BigEndian) of the string first, then write the string.

func (*Writer) WriteStringUint32

func (w *Writer) WriteStringUint32(s string)

Write the length(Uint32) of the string first, then write the string.

func (*Writer) WriteStringUint32BigEndian

func (w *Writer) WriteStringUint32BigEndian(s string)

Write the length(Uint32 BigEndian) of the string first, then write the string.

func (*Writer) WriteStringUint64

func (w *Writer) WriteStringUint64(s string)

Write the length(Uint16) of the string first, then write the string.

func (*Writer) WriteStringUint64BigEndian

func (w *Writer) WriteStringUint64BigEndian(s string)

Write the length(Uint16) of the string first, then write the string.

func (*Writer) WriteUint8

func (w *Writer) WriteUint8(i uint8)

Write uint8 into Writer.

func (*Writer) WriteUint16

func (w *Writer) WriteUint16(i uint16)

Write uint16 with LittleEndian into Writer.

func (*Writer) WriteUint16BigEndian

func (w *Writer) WriteUint16BigEndian(i uint16)

Write uint16 with BigEndian into Writer.

func (*Writer) WriteUint32

func (w *Writer) WriteUint32(i uint32)

Write uint32 with LittleEndian into Writer.

func (*Writer) WriteUint32BigEndian

func (w *Writer) WriteUint32BigEndian(i uint32)

Write uint32 with BigEndian into Writer.

func (*Writer) WriteUint64

func (w *Writer) WriteUint64(i uint64)

Write uint64 with LittleEndian into Writer.

func (*Writer) WriteUint64BigEndian

func (w *Writer) WriteUint64BigEndian(i uint64)

Write uint64 with BigEndian into Writer.

Jump to

Keyboard shortcuts

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