44 lines
1.0 KiB
Go
44 lines
1.0 KiB
Go
package uio
|
|
|
|
type Source interface {
|
|
Read(dst []byte) (n int, err error)
|
|
ReadFully(dst []byte) error
|
|
}
|
|
|
|
type BufferedSource interface {
|
|
Source
|
|
|
|
ReadByte() (byte, error)
|
|
ReadUByte() (uint8, error)
|
|
|
|
ReadShortLE() (int16, error)
|
|
ReadShortBE() (int16, error)
|
|
ReadIntLE() (int32, error)
|
|
ReadIntBE() (int32, error)
|
|
ReadLongLE() (int64, error)
|
|
ReadLongBE() (int64, error)
|
|
|
|
ReadUShortLE() (uint16, error)
|
|
ReadUShortBE() (uint16, error)
|
|
ReadUIntLE() (uint32, error)
|
|
ReadUIntBE() (uint32, error)
|
|
ReadULongLE() (uint64, error)
|
|
ReadULongBE() (uint64, error)
|
|
|
|
ReadFloatLE() (float32, error)
|
|
ReadFloatBE() (float32, error)
|
|
ReadDoubleLE() (float64, error)
|
|
ReadDoubleBE() (float64, error)
|
|
|
|
// ReadShortByteArray reads a size-prefixed byte array.
|
|
// Structure: [ShortLE : size][size bytes data]
|
|
ReadShortByteArray() ([]byte, error)
|
|
|
|
// ReadByteArray reads a size-prefixed byte array.
|
|
// Structure: [IntLE : size][size bytes data]
|
|
ReadByteArray() ([]byte, error)
|
|
|
|
ReadShortString() (string, error)
|
|
ReadString() (string, error)
|
|
}
|