示例#1
0
func consume(buffer *tunnel.LinkBuffer) bool {
	var output string
	for {
		data, ok := buffer.Pop()
		if !ok {
			break
		}
		output += string(data)
		if len(output) == len(input) {
			break
		}
	}
	if input != output {
		return false
	}
	return true
}
示例#2
0
func produce(buffer *tunnel.LinkBuffer) {
	for i := 0; i < len(input); i++ {
		buffer.Put([]byte(input[i : i+1]))
	}
}