Source File
readwriter.go
Belonging Package
vendor/golang.org/x/text/unicode/norm
package norm
import
type normWriter struct {
rb reorderBuffer
w io.Writer
buf []byte
}
const = 4000
func ( Form) ( io.Writer) io.WriteCloser {
:= &normWriter{rb: reorderBuffer{}, w: }
.rb.init(, nil)
return
}
type normReader struct {
rb reorderBuffer
r io.Reader
inbuf []byte
outbuf []byte
bufStart int
lastBoundary int
err error
}
func ( *normReader) ( []byte) (int, error) {
for {
if .lastBoundary-.bufStart > 0 {
:= copy(, .outbuf[.bufStart:.lastBoundary])
.bufStart +=
if .lastBoundary-.bufStart > 0 {
return , nil
}
return , .err
}
if .err != nil {
return 0, .err
}
:= copy(.outbuf, .outbuf[.lastBoundary:])
.outbuf = .outbuf[0:]
.bufStart = 0
, := .r.Read(.inbuf)
.rb.src = inputBytes(.inbuf[0:])
.rb.nsrc, .err = ,
if > 0 {
.outbuf = doAppend(&.rb, .outbuf, 0)
}
if == io.EOF {
.lastBoundary = len(.outbuf)
} else {
.lastBoundary = lastBoundary(&.rb.f, .outbuf)
if .lastBoundary == -1 {
.lastBoundary = 0
}
}
}
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |