Package org.eclipse.jgit.lfs
Class LfsPointer
- java.lang.Object
-
- org.eclipse.jgit.lfs.LfsPointer
-
- All Implemented Interfaces:
Comparable<LfsPointer>
public class LfsPointer extends Object implements Comparable<LfsPointer>
Represents an LFS pointer file- Since:
- 4.6
-
-
Field Summary
Fields Modifier and Type Field Description static String
HASH_FUNCTION_NAME
The name of the hash function as used in the pointer files.static int
SIZE_THRESHOLD
Don't inspect files that are larger than this threshold to avoid excessive reading.static String
VERSION
The version of the LfsPointer file formatstatic String
VERSION_LEGACY
The version of the LfsPointer file format using legacy URL
-
Constructor Summary
Constructors Constructor Description LfsPointer(AnyLongObjectId oid, long size)
Constructor for LfsPointer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(LfsPointer o)
void
encode(OutputStream out)
Encode this object into the LFS format defined byVERSION
boolean
equals(Object obj)
AnyLongObjectId
getOid()
Getter for the fieldoid
.long
getSize()
Getter for the fieldsize
.int
hashCode()
static LfsPointer
parseLfsPointer(InputStream in)
Try to parse the data provided by an InputStream to the format defined byVERSION
.String
toString()
-
-
-
Field Detail
-
VERSION
public static final String VERSION
The version of the LfsPointer file format- See Also:
- Constant Field Values
-
VERSION_LEGACY
public static final String VERSION_LEGACY
The version of the LfsPointer file format using legacy URL- Since:
- 4.7
- See Also:
- Constant Field Values
-
SIZE_THRESHOLD
public static final int SIZE_THRESHOLD
Don't inspect files that are larger than this threshold to avoid excessive reading. No pointer file should be larger than this.- Since:
- 4.11
- See Also:
- Constant Field Values
-
HASH_FUNCTION_NAME
public static final String HASH_FUNCTION_NAME
The name of the hash function as used in the pointer files. This will evaluate to "sha256"
-
-
Constructor Detail
-
LfsPointer
public LfsPointer(AnyLongObjectId oid, long size)
Constructor for LfsPointer.
- Parameters:
oid
- the id of the contentsize
- the size of the content
-
-
Method Detail
-
getOid
public AnyLongObjectId getOid()
Getter for the field
oid
.- Returns:
- the id of the content
-
getSize
public long getSize()
Getter for the field
size
.- Returns:
- the size of the content
-
encode
public void encode(OutputStream out)
Encode this object into the LFS format defined byVERSION
- Parameters:
out
- theOutputStream
into which the encoded data should be written
-
parseLfsPointer
@Nullable public static LfsPointer parseLfsPointer(InputStream in) throws IOException
Try to parse the data provided by an InputStream to the format defined byVERSION
. If the given stream supports mark and reset as indicated byInputStream.markSupported()
, its input position will be reset if the stream content is not actually a LFS pointer (i.e., whennull
is returned). If the stream content is an invalid LFS pointer or the given stream does not support mark/reset, the input position may not be reset.- Parameters:
in
- theInputStream
from where to read the data- Returns:
- an
LfsPointer
ornull
if the stream was not parseable as LfsPointer - Throws:
IOException
-
compareTo
public int compareTo(LfsPointer o)
- Specified by:
compareTo
in interfaceComparable<LfsPointer>
- Since:
- 4.11
-
-