return &BlobDecoder{d: d, ChunkLen: chunkLen}, nil
}
+func (d *BlobDecoder) SetReadBuf(buf []byte) {
+ d.d.readBuf = buf
+}
+
// Get the next chunk of the BLOB. Last one may be smaller size than the
// ChunkLen. When BLOB is finished, io.EOF is returned with nil chunk.
func (d *BlobDecoder) Next() (chunk []byte, err error) {
if seal {
n, errR = io.ReadFull(r, j.buf[PadLen:PadLen+ChunkLen])
} else {
+ blobDecoder.SetReadBuf(j.buf)
chunk, errR = blobDecoder.Next()
- copy(j.buf, chunk)
n = len(chunk)
j.buf = j.buf[:n]
}