PackFile.decode constructor
Implementation
PackFile.decode(this.idx, this.filePath, Uint8List headerBytes) {
assert(headerBytes.length == _headerSize);
var reader = ByteDataReader(endian: Endian.big, copy: false);
reader.add(headerBytes);
// Read the signature
var sigBytes = reader.read(4);
if (sigBytes.length != 4) {
throw Exception('GitPackFileCorrupted: Invalid Signature lenght');
}
var sig = ascii.decode(sigBytes);
if (sig != 'PACK') {
throw Exception('GitPackFileCorrupted: Invalid signature $sig');
}
// Version
var version = reader.readUint32();
if (version != 2) {
throw Exception('GitPackFileCorrupted: Unsupported version: $version');
}
numObjects = reader.readUint32();
}