func (rb *ResumableBuffer) Next() {
	rb.off += int64(len(rb.chunk))
	rb.chunk = rb.chunk[0:0]
}
Next advances to the next chunk, which will be returned by the next call to Chunk.
Calls to Next without a corresponding prior call to Chunk will have no effect.
package gensupport
import (
	"bytes"
	"io"
	"google.golang.org/api/googleapi"
)
type ResumableBuffer struct {
	media io.Reader
	chunk []byte  
	err   error   
	off int64
}
func NewResumableBuffer(media io.Reader, chunkSize int) *ResumableBuffer {
	return &ResumableBuffer{media: media, chunk: make([]byte, 0, chunkSize)}
}
func (rb *ResumableBuffer) Chunk() (chunk io.Reader, off int64, size int, err error) {
	if rb.err == nil && len(rb.chunk) == 0 {
		rb.err = rb.loadChunk()
	}
	return bytes.NewReader(rb.chunk), rb.off, len(rb.chunk), rb.err
}
func (rb *ResumableBuffer) loadChunk() error {
	bufSize := cap(rb.chunk)
	rb.chunk = rb.chunk[:bufSize]
	read := 0
	var err error
	for err == nil && read < bufSize {
		var n int
		n, err = rb.media.Read(rb.chunk[read:])
		read += n
	}
	rb.chunk = rb.chunk[:read]
	return err
}