Skip to content

Commit

Permalink
move writer out
Browse files Browse the repository at this point in the history
  • Loading branch information
miku committed Oct 10, 2018
1 parent 8d86570 commit 4552c64
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
12 changes: 12 additions & 0 deletions io.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package zek

// countwriter counts bytes written to it. Does not support concurrent access.
type countwriter struct {
n int64
}

// Write increments the number by len(p).
func (w *countwriter) Write(p []byte) (n int, err error) {
w.n += w.n + int64(len(p))
return len(p), nil
}
11 changes: 0 additions & 11 deletions node.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@ import (
"golang.org/x/net/html/charset"
)

// countwriter counts bytes written to it. Does not support concurrent access.
type countwriter struct {
n int64
}

// Write increments the number by len(p).
func (w *countwriter) Write(p []byte) (n int, err error) {
w.n += w.n + int64(len(p))
return len(p), nil
}

// Node represents an element in the XML tree. It keeps track of its name,
// attributes, childnodes and example chardata and basic statistics, e.g. how
// often a node has been seen within its parent node.
Expand Down

0 comments on commit 4552c64

Please sign in to comment.