private boolean notInCache(long pos) { return cache.get(file.key, file.alignToBlock(pos)) == null; }
b = cache.getOrLoad(this, position, ctx, rc); } else { b = cache.get(key, alignToBlock(position)); if (b == null) { rc = ctx.db.openFile(desc, PACK);
private DfsBlock getOrLoadBlock(long pos) throws IOException { long s = toBlockStart(pos); DfsBlock b = cache.get(packKey, s); if (b != null) return b; byte[] d = new byte[blockSize]; for (int p = 0; p < blockSize;) { int n = out.read(s + p, ByteBuffer.wrap(d, p, blockSize - p)); if (n <= 0) throw new EOFException(JGitText.get().unexpectedEofInPack); p += n; } b = new DfsBlock(packKey, s, d); cache.put(b); return b; }
b = cache.getOrLoad(this, position, ctx, rc); } else { b = cache.get(key, alignToBlock(position)); if (b == null) { rc = ctx.db.openFile(desc, PACK);
readBlock = blockCache.get(packKey, start); if (readBlock == null) { int size = (int) Math.min(blockSize, packEnd - start);
boolean packHeadSkipped = false; while (0 < remaining) { DfsBlock b = cache.get(key, alignToBlock(position)); if (b != null) { int ptr = (int) (position - b.start);
private boolean notInCache(long pos) { return cache.get(file.key, file.alignToBlock(pos)) == null; }
private DfsBlock getOrLoadBlock(long pos) throws IOException { long s = toBlockStart(pos); DfsBlock b = cache.get(packKey, s); if (b != null) return b; byte[] d = new byte[blockSize]; for (int p = 0; p < blockSize;) { int n = out.read(s + p, ByteBuffer.wrap(d, p, blockSize - p)); if (n <= 0) throw new EOFException(JGitText.get().unexpectedEofInPack); p += n; } b = new DfsBlock(packKey, s, d); cache.put(b); return b; }
private DfsBlock getOrLoadBlock(long pos) throws IOException { long s = toBlockStart(pos); DfsBlock b = cache.get(packKey, s); if (b != null) return b; byte[] d = new byte[blockSize]; for (int p = 0; p < blockSize;) { int n = out.read(s + p, ByteBuffer.wrap(d, p, blockSize - p)); if (n <= 0) throw new EOFException(DfsText.get().unexpectedEofInPack); p += n; } b = new DfsBlock(packKey, s, d); cache.put(b); return b; }
@Override protected int readDatabase(byte[] dst, int pos, int cnt) throws IOException { if (cnt == 0) return 0; if (currPos <= readPos) { // Requested read is still buffered. Copy direct from buffer. int p = (int) (readPos - currPos); int n = Math.min(cnt, currEnd - p); if (n == 0) throw new EOFException(); System.arraycopy(currBuf, p, dst, pos, n); readPos += n; return n; } if (readBlock == null || !readBlock.contains(packKey, readPos)) { long start = toBlockStart(readPos); readBlock = blockCache.get(packKey, start); if (readBlock == null) { int size = (int) Math.min(blockSize, packEnd - start); byte[] buf = new byte[size]; if (read(start, buf, 0, size) != size) throw new EOFException(); readBlock = new DfsBlock(packKey, start, buf); blockCache.put(readBlock); } } int n = readBlock.copy(readPos, dst, pos, cnt); readPos += n; return n; }
readBlock = blockCache.get(packKey, start); if (readBlock == null) { int size = (int) Math.min(blockSize, packEnd - start);
long remaining = length - (12 + 20); while (0 < remaining) { DfsBlock b = cache.get(key, alignToBlock(position)); if (b != null) { int ptr = (int) (position - b.start);
boolean packHeadSkipped = false; while (0 < remaining) { DfsBlock b = cache.get(key, alignToBlock(position)); if (b != null) { int ptr = (int) (position - b.start);