var dataChunkPools … func getDataBufferChunk(size int64) []byte { … } func putDataBufferChunk(p []byte) { … } type dataBuffer … var errReadEmpty … // Read copies bytes from the buffer into p. // It is an error to read when no data is available. func (b *dataBuffer) Read(p []byte) (int, error) { … } func (b *dataBuffer) bytesFromFirstChunk() []byte { … } // Len returns the number of bytes of the unread portion of the buffer. func (b *dataBuffer) Len() int { … } // Write appends p to the buffer. func (b *dataBuffer) Write(p []byte) (int, error) { … } func (b *dataBuffer) lastChunkOrAlloc(want int64) []byte { … }