Package org.eclipse.jgit.lfs
Class LfsPointer
java.lang.Object
org.eclipse.jgit.lfs.LfsPointer
- All Implemented Interfaces:
Comparable<LfsPointer>
Represents an LFS pointer file
- Since:
- 4.6
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int
SIZE_THRESHOLD
is too low; with lfs extensions a LFS pointer can be larger.static final String
The name of the hash function as used in the pointer files.private final AnyLongObjectId
private final long
static final int
Don't inspect files that are larger than this threshold to avoid excessive reading.static final String
The version of the LfsPointer file formatstatic final String
The version of the LfsPointer file format using legacy URL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static boolean
checkVersion
(byte[] data) private static boolean
int
void
encode
(OutputStream out) Encode this object into the LFS format defined byVERSION
boolean
getOid()
Getter for the fieldoid
.long
getSize()
Getter for the fieldsize
.int
hashCode()
private static LfsPointer
private static LfsPointer
parse
(InputStream in) static LfsPointer
Try to parse the data provided by an InputStream to the format defined byVERSION
.toString()
-
Field Details
-
VERSION
The version of the LfsPointer file format- See Also:
-
VERSION_LEGACY
The version of the LfsPointer file format using legacy URL- Since:
- 4.7
- See Also:
-
SIZE_THRESHOLD
public static final int SIZE_THRESHOLDDon'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:
-
HASH_FUNCTION_NAME
The name of the hash function as used in the pointer files. This will evaluate to "sha256" -
FULL_SIZE_THRESHOLD
static final int FULL_SIZE_THRESHOLDSIZE_THRESHOLD
is too low; with lfs extensions a LFS pointer can be larger. But 8kB should be more than enough.- See Also:
-
oid
-
size
private final long size
-
-
Constructor Details
-
LfsPointer
Constructor for LfsPointer.
- Parameters:
oid
- the id of the contentsize
- the size of the content
-
-
Method Details
-
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
Encode this object into the LFS format defined byVERSION
- Parameters:
out
- theOutputStream
into which the encoded data should be written
-
parseLfsPointer
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
-
parse
- Throws:
IOException
-
parse
- Throws:
IOException
-
checkVersion
private static boolean checkVersion(byte[] data) -
checkVersionLine
-
toString
-
compareTo
- Specified by:
compareTo
in interfaceComparable<LfsPointer>
- Since:
- 4.11
-
hashCode
public int hashCode() -
equals
-