Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conn ¶
func (*Conn) RemoteAddr ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader counts the bytes read through it.
func NewReader ¶
NewReader makes a new Reader that counts the bytes read through it.
Example ¶
package main
import (
"fmt"
"io"
"os"
"strings"
"github.com/cryptix/go/logging/countconn"
)
func main() {
r := strings.NewReader("hello, world\n")
rc := countconn.NewReader(r)
n, err := io.Copy(os.Stdout, rc)
fmt.Println(err)
fmt.Println(n)
fmt.Println(rc.N())
}
Output: hello, world <nil> 13 13
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer counts the bytes read through it.
func NewWriter ¶
NewWriter makes a new Writer that counts the bytes read through it.
Example ¶
package main
import (
"bytes"
"fmt"
"io"
"strings"
"github.com/cryptix/go/logging/countconn"
)
func main() {
var w bytes.Buffer
wc := countconn.NewWriter(&w)
n, err := io.Copy(wc, strings.NewReader("hello, world\n"))
fmt.Print(w.String())
fmt.Println(err)
fmt.Println(n)
fmt.Println(wc.N())
}
Output: hello, world <nil> 13 13
Click to show internal directories.
Click to hide internal directories.