Files
go_goutils/encodingx/binarystr/funcs_badnumocterr.go
T
brent saner 7ec35990a9 v1.17.6
ADDED:
* mapsx.(ListSortedKeys|ListSortedValues|SortedKeys|SortedValues)
2026-10-10 01:32:35 -04:00

33 lines
1.2 KiB
Go

package binarystr
import "fmt"
// BytePos returns the byte position index immediately leading up to the error.
func (b *BadNumOctErr) BytePos() (pos uint64) { return b.posByte }
// Error returns the error message for a BadNumOctError. It conforms to an [error] interface.
func (b *BadNumOctErr) Error() (err string) {
err = fmt.Sprintf(
"only able to read %d complete octets/bytes (%#d runes/characters); "+
"%d remaining characters are less than 8 bits",
b.posByte, b.posRune,
len(b.rem),
)
return
}
/*
Rem returns the remaining unparsed string of characters; this should ALWAYS be a length of 0 <= len(rem) < 8.
(It will only be an empty string if [Decoder.Read] encountered the end of its source reader before the buffer was filled,
but the available data cleanly broke into a last octet.)
*/
func (b *BadNumOctErr) Rem() (rem string) { return b.rem }
// RunePos returns the rune (character) position index immediately leading up to the error.
func (b *BadNumOctErr) RunePos() (pos uint64) { return b.posRune }
// String is an alias for the [BadNumOctErr.Error] method to conform explicitly to a [fmt.Stringer] interface.
func (b *BadNumOctErr) String() (s string) { return b.Error() }