1
2
3
4
5
6
7
8
9
10
11 package org.eclipse.jgit.internal.storage.dfs;
12
13 import java.io.IOException;
14
15 import org.eclipse.jgit.internal.storage.pack.CachedPack;
16 import org.eclipse.jgit.internal.storage.pack.ObjectToPack;
17 import org.eclipse.jgit.internal.storage.pack.PackOutputStream;
18 import org.eclipse.jgit.internal.storage.pack.StoredObjectRepresentation;
19
20
21
22
23 public class DfsCachedPack extends CachedPack {
24 private final DfsPackFile pack;
25
26 DfsCachedPack(DfsPackFile pack) {
27 this.pack = pack;
28 }
29
30
31
32
33 public DfsPackFile getPackFile() {
34 return pack;
35 }
36
37
38
39
40
41
42 public DfsPackDescription getPackDescription() {
43 return pack.getPackDescription();
44 }
45
46
47 @Override
48 public long getObjectCount() throws IOException {
49 return getPackDescription().getObjectCount();
50 }
51
52
53 @Override
54 public long getDeltaCount() throws IOException {
55 return getPackDescription().getDeltaCount();
56 }
57
58
59 @Override
60 public boolean hasObject(ObjectToPack obj, StoredObjectRepresentation rep) {
61 return ((DfsObjectRepresentation) rep).pack == pack;
62 }
63
64 void copyAsIs(PackOutputStream out, DfsReader ctx) throws IOException {
65 pack.copyPackAsIs(out, ctx);
66 }
67 }