예제 #1
0
파일: pack.go 프로젝트: jbrukh/ggit
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,
	}
}
예제 #2
0
파일: blobs.go 프로젝트: jbrukh/ggit
// 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
}