go-htmlescape/write.go

39 lines
650 B
Go
Raw Permalink Normal View History

2024-02-13 05:35:42 +00:00
package htmlescape
import (
"io"
)
func WriteBytes(writer io.Writer, bytes []byte) (n int, err error) {
var buffer [bufferSize]byte
var p []byte = buffer[0:0]
p, err = AppendBytes(p, bytes)
if nil != err {
return 0, err
}
return writer.Write(p)
}
func WriteRune(writer io.Writer, r rune) (n int, err error) {
var buffer [bufferSize]byte
var p []byte = buffer[0:0]
p = AppendRune(p,r)
return writer.Write(p)
}
func WriteString(writer io.Writer, str string) (n int, err error) {
var buffer [bufferSize]byte
var p []byte = buffer[0:0]
p, err = AppendString(p, str)
if nil != err {
return 0, err
}
return writer.Write(p)
}