blob: af8cd46d0118627c8635cd05a922290b33d1f31f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/*
* Copyright (C) 2011, Google Inc. and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0 which is available at
* https://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package org.eclipse.jgit.internal.storage.dfs;
import java.io.IOException;
import org.eclipse.jgit.internal.storage.pack.CachedPack;
import org.eclipse.jgit.internal.storage.pack.ObjectToPack;
import org.eclipse.jgit.internal.storage.pack.PackOutputStream;
import org.eclipse.jgit.internal.storage.pack.StoredObjectRepresentation;
/**
* A DfsPackFile available for reuse as-is.
*/
public class DfsCachedPack extends CachedPack {
private final DfsPackFile pack;
DfsCachedPack(DfsPackFile pack) {
this.pack = pack;
}
/**
* Get pack file
*
* @return the pack passed to the constructor
*/
public DfsPackFile getPackFile() {
return pack;
}
/**
* Get the description of the pack.
*
* @return the description of the pack.
*/
public DfsPackDescription getPackDescription() {
return pack.getPackDescription();
}
@Override
public long getObjectCount() throws IOException {
return getPackDescription().getObjectCount();
}
@Override
public long getDeltaCount() throws IOException {
return getPackDescription().getDeltaCount();
}
@Override
public boolean hasObject(ObjectToPack obj, StoredObjectRepresentation rep) {
return ((DfsObjectRepresentation) rep).pack == pack;
}
void copyAsIs(PackOutputStream out, DfsReader ctx) throws IOException {
pack.copyPackAsIs(out, ctx);
}
}
|