Documentation ¶
Index ¶
- Constants
- type IReader
- type Reader
- func (r *Reader) GetInternalReader() io.Reader
- func (r *Reader) Read(dst []byte) (n int, err error)
- func (r *Reader) Read2Bytes() (bytes []byte, err error)
- func (r *Reader) Read4Bytes() (bytes []byte, err error)
- func (r *Reader) Read8Bytes() (bytes []byte, err error)
- func (r *Reader) ReadByte() (ub byte, err error)
- func (r *Reader) ReadBytes(size int) (bytes []byte, err error)
- func (r *Reader) ReadDWord_BE() (dw bt.DWord, err error)
- func (r *Reader) ReadDWord_LE() (dw bt.DWord, err error)
- func (r *Reader) ReadDouble_BE() (d float64, err error)
- func (r *Reader) ReadDouble_LE() (d float64, err error)
- func (r *Reader) ReadFloat_BE() (f float32, err error)
- func (r *Reader) ReadFloat_LE() (f float32, err error)
- func (r *Reader) ReadLineEndingWithCRLF() (line []byte, err error)
- func (r *Reader) ReadSByte() (sb int8, err error)
- func (r *Reader) ReadSLong_BE() (sl int32, err error)
- func (r *Reader) ReadSLong_LE() (sl int32, err error)
- func (r *Reader) ReadSShort_BE() (ss int16, err error)
- func (r *Reader) ReadSShort_LE() (ss int16, err error)
- func (r *Reader) ReadULong_BE() (ul uint32, err error)
- func (r *Reader) ReadULong_LE() (ul uint32, err error)
- func (r *Reader) ReadUShort_BE() (us uint16, err error)
- func (r *Reader) ReadUShort_LE() (us uint16, err error)
- func (r *Reader) ReadWord_BE() (w bt.Word, err error)
- func (r *Reader) ReadWord_LE() (w bt.Word, err error)
Constants ¶
const ( CR = '\r' LF = '\n' )
ASCII symbols.
const ErrUnexpectedDataSize = "unexpected data size: %v vs %v"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IReader ¶ added in v0.9.1
type IReader interface { io.Reader GetInternalReader() io.Reader ReadLineEndingWithCRLF() (line []byte, err error) ReadBytes(size int) (bytes []byte, err error) ReadByte() (ub byte, err error) ReadSByte() (sb int8, err error) Read2Bytes() (bytes []byte, err error) Read4Bytes() (bytes []byte, err error) Read8Bytes() (bytes []byte, err error) ReadWord_BE() (w bt.Word, err error) ReadWord_LE() (w bt.Word, err error) ReadDWord_BE() (dw bt.DWord, err error) ReadDWord_LE() (dw bt.DWord, err error) ReadUShort_BE() (us uint16, err error) ReadUShort_LE() (us uint16, err error) ReadULong_BE() (ul uint32, err error) ReadULong_LE() (ul uint32, err error) ReadSShort_BE() (ss int16, err error) ReadSShort_LE() (ss int16, err error) ReadSLong_BE() (sl int32, err error) ReadSLong_LE() (sl int32, err error) ReadFloat_BE() (f float32, err error) ReadFloat_LE() (f float32, err error) ReadDouble_BE() (d float64, err error) ReadDouble_LE() (d float64, err error) }
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func (*Reader) GetInternalReader ¶ added in v0.8.0
func (*Reader) Read2Bytes ¶ added in v0.8.0
Read2Bytes reads two bytes.
func (*Reader) Read4Bytes ¶ added in v0.8.0
Read4Bytes reads four bytes.
func (*Reader) Read8Bytes ¶ added in v0.8.0
Read8Bytes reads eight bytes.
func (*Reader) ReadBytes ¶
ReadBytes reads an exact number of bytes. This method is different from the common 'Read' method of an 'io.Reader' interface in that it returns the actual number of bytes read. In other words, if the specified number of bytes is not available, only those bytes which were available are returned. If there is no data available, an empty array (slice) is returned. When there is no error – the full-size array (slice) of bytes should be returned, but it is not going to happen because modern Go language has bugs in several built-in libraries implementing the 'io.Reader' interface:
bytes: return EOF early in Reader.Read #21852 https://github.com/golang/go/issues/21852 destel opened this issue on Sep 13, 2017
bytes: bytes.Reader returns EOF on zero-byte Read, which doesn't conform with io.Reader interface documentation #40385 https://github.com/golang/go/issues/40385 metala opened this issue on Jul 24, 2020
bytes: bytes.Reader violates the io.Reader and io.EOF main principle #59253 https://github.com/golang/go/issues/59253
io: Documentation of the io package at website is contrary to its documentation in comments inside source code. #59254 https://github.com/golang/go/issues/59254
func (*Reader) ReadDWord_BE ¶ added in v0.8.0
ReadDWord_BE reads a double word using the big endian technique.
func (*Reader) ReadDWord_LE ¶ added in v0.8.0
ReadDWord_LE reads a double word using the little endian technique.
func (*Reader) ReadDouble_BE ¶ added in v0.8.0
ReadDouble_BE reads a Double using the big endian technique.
func (*Reader) ReadDouble_LE ¶ added in v0.8.0
ReadDouble_LE reads a Double using the little endian technique.
func (*Reader) ReadFloat_BE ¶ added in v0.8.0
ReadFloat_BE reads a Float using the big endian technique.
func (*Reader) ReadFloat_LE ¶ added in v0.8.0
ReadFloat_LE reads a Float using the little endian technique.
func (*Reader) ReadLineEndingWithCRLF ¶
ReadLineEndingWithCRLF reads a line ending exactly with the 'CR'+'LF' symbols sequence. The two symbols at the end of the line (CR+LF) are included into the returned result. On error, returns the last read sequence of bytes, even if it does not have a correct ending.
func (*Reader) ReadSLong_BE ¶ added in v0.8.0
ReadSLong_BE reads a signed long using the big endian technique.
func (*Reader) ReadSLong_LE ¶ added in v0.8.0
ReadSLong_LE reads a signed long using the little endian technique.
func (*Reader) ReadSShort_BE ¶ added in v0.8.0
ReadSShort_BE reads a signed short using the big endian technique.
func (*Reader) ReadSShort_LE ¶ added in v0.8.0
ReadSShort_LE reads a signed short using the little endian technique.
func (*Reader) ReadULong_BE ¶ added in v0.8.0
ReadULong_BE reads an unsigned long using the big endian technique.
func (*Reader) ReadULong_LE ¶ added in v0.8.0
ReadULong_LE reads an unsigned long using the little endian technique.
func (*Reader) ReadUShort_BE ¶ added in v0.8.0
ReadUShort_BE reads an unsigned short using the big endian technique.
func (*Reader) ReadUShort_LE ¶ added in v0.8.0
ReadUShort_LE reads an unsigned short using the little endian technique.
func (*Reader) ReadWord_BE ¶ added in v0.8.0
ReadWord_BE reads a word using the big endian technique.