Beispiel #1
0
func (dp *packedObjectParser) parseBlob(size int64) *PackedObject {
	data := dp.Bytes()
	oid := dp.objectParser.oid
	hdr := objects.NewObjectHeader(objects.ObjectBlob, size)
	blob := objects.NewBlob(oid, hdr, data)
	return &PackedObject{
		object: blob,
		bytes:  data,
	}
}
Beispiel #2
0
// parseBlob parses the payload of a binary blob object
// and converts it to Blob. If there are parsing errors,
// it panics with parseErr, so this method should be
// called as a parameter a safeParse().
func (p *objectParser) parseBlob() *objects.Blob {

	p.ResetCount()
	data := p.Bytes()
	b := objects.NewBlob(p.oid, p.hdr, data)

	if p.Count() != p.hdr.Size() {
		util.PanicErr("payload doesn't match prescibed size")
	}

	return b
}