Documentation ¶
Overview ¶
Package bom nolint
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadSkipBOM ¶
ReadSkipBOM creates Reader which automatically detects BOM (Unicode Byte Order Mark) and removes it as necessary. It also returns the encoding detected by the BOM. If the detected encoding is not needed, you can call the ReadSkipBOM function.
Types ¶
type Encoding ¶
type Encoding int
Encoding is type alias for detected UTF encoding.
const ( // Unknown encoding, returned when no BOM was detected Unknown Encoding = iota // UTF8 , BOM bytes: EF BB BF UTF8 // UTF16BigEndian UTF-16, big-endian, BOM bytes: FE FF UTF16BigEndian // UTF16LittleEndian UTF-16, little-endian, BOM bytes: FF FE UTF16LittleEndian // UTF32BigEndian UTF-32, big-endian, BOM bytes: 00 00 FE FF UTF32BigEndian // UTF32LittleEndian UTF-32, little-endian, BOM bytes: FF FE 00 00 UTF32LittleEndian )
Constants to identify detected UTF encodings.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader implements automatic BOM (Unicode Byte Order Mark) checking and removing as necessary for an io.Reader object.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer implements automatic BOM (Unicode Byte Order Mark) write
func WriteWithBOM ¶
WriteWithBOM creates Writer which automatically write BOM (Unicode Byte Order Mark).
func (*Writer) Buffered ¶
Buffered returns the number of bytes that have been written into the current buffer.