public override void materialize(WindowCursor curs) { if (cachedBytes != null) { return; } if (objectType != OBJ_COMMIT) { UnpackedObjectCache.Entry cache = pack.readCache(dataOffset); if (cache != null) { curs.release(); cachedBytes = cache.data; return; } } try { cachedBytes = pack.decompress(dataOffset, objectSize, curs); curs.release(); if (objectType != OBJ_COMMIT) pack.saveCache(dataOffset, cachedBytes, objectType); } catch (IOException dfe) { CorruptObjectException coe; coe = new CorruptObjectException("object at " + dataOffset + " in " + pack.File.FullName + " has bad zlib stream", dfe); throw coe; } }
public override void materialize(WindowCursor curs) { if (cachedBytes != null) { return; } if (objectType != OBJ_COMMIT) { UnpackedObjectCache.Entry cache = pack.readCache(dataOffset); if (cache != null) { curs.release(); objectType = cache.type; objectSize = cache.data.Length; cachedBytes = cache.data; return; } } try { PackedObjectLoader baseLoader = getBaseLoader(curs); baseLoader.materialize(curs); cachedBytes = BinaryDelta.Apply(baseLoader.getCachedBytes(), pack.decompress(dataOffset, deltaSize, curs)); curs.release(); objectType = baseLoader.getType(); objectSize = cachedBytes.Length; if (objectType != OBJ_COMMIT) pack.saveCache(dataOffset, cachedBytes, objectType); } catch (IOException dfe) { CorruptObjectException coe; coe = new CorruptObjectException("object at " + dataOffset + " in " + pack.File.FullName + " has bad zlib stream", dfe); throw coe; } }
/** * @param id * SHA-1 of an object. * * @return a {@link ObjectLoader} for accessing the data of the named * object, or null if the object does not exist. * @ */ public ObjectLoader OpenObject(AnyObjectId id) { WindowCursor wc = new WindowCursor(); try { return openObject(wc, id); } finally { wc.release(); } }
/** * @param curs cursor to release; may be null. * @return always null. */ public static WindowCursor release(WindowCursor curs) { if (curs != null) curs.release(); return null; }