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() }