示例#1
0
func readers() {
	r := strings.NewReader("Hello, Reader!")

	b := make([]byte, 8)
	for {
		n, err := r.Read(b)
		fmt.Printf("n = %v err = %v b = %v\n", n, err, b)
		fmt.Printf("b[:n] = %q\n", b[:n])
		if err == io.EOF {
			break
		}
	}

	reader.Validate(MyReader{})
	rot13test()

	s := strings.NewReader("Lbh penpxrq gur pbqr!")
	r13 := rot13Reader{s}
	io.Copy(os.Stdout, &r13)
	fmt.Println()
}
示例#2
0
func main() {
	reader.Validate(MyReader{})
}
示例#3
0
func showReader2() {
	reader.Validate(MyReader{})
}
func ExerciseReaders() {
	reader.Validate(MyReader{})
}
示例#5
0
func testReader() {
	reader.Validate(MyReader{})
}
示例#6
0
func TestReader2(t *testing.T) {
	reader.Validate(MyReader{})
}