1
2
3
4
5
6
7
8
9
10 package org.eclipse.jgit.lfs.lib;
11
12 import java.security.MessageDigest;
13 import java.security.NoSuchAlgorithmException;
14 import java.text.MessageFormat;
15
16 import org.eclipse.jgit.lfs.internal.LfsText;
17
18
19
20
21
22
23 @SuppressWarnings("nls")
24 public final class Constants {
25
26
27
28
29
30 public static final String LFS = "lfs";
31
32
33
34
35
36
37 public static final String LONG_HASH_FUNCTION = "SHA-256";
38
39
40
41
42
43
44
45 public static final int LONG_OBJECT_ID_LENGTH = 32;
46
47
48
49
50
51
52
53 public static final int LONG_OBJECT_ID_STRING_LENGTH = LONG_OBJECT_ID_LENGTH
54 * 2;
55
56
57
58
59
60
61 public static final String UPLOAD = "upload";
62
63
64
65
66
67
68 public static final String DOWNLOAD = "download";
69
70
71
72
73
74
75 public static final String VERIFY = "verify";
76
77
78
79
80
81
82 public static final String ATTR_FILTER_DRIVER_PREFIX = "lfs/";
83
84
85
86
87
88
89
90
91
92
93 public static MessageDigest newMessageDigest() {
94 try {
95 return MessageDigest.getInstance(LONG_HASH_FUNCTION);
96 } catch (NoSuchAlgorithmException nsae) {
97 throw new RuntimeException(MessageFormat.format(
98 LfsText.get().requiredHashFunctionNotAvailable,
99 LONG_HASH_FUNCTION), nsae);
100 }
101 }
102
103 static {
104 if (LONG_OBJECT_ID_LENGTH != newMessageDigest().getDigestLength())
105 throw new LinkageError(
106 LfsText.get().incorrectLONG_OBJECT_ID_LENGTH);
107 }
108
109
110
111
112
113
114 public static final String CONTENT_TYPE_GIT_LFS_JSON = "application/vnd.git-lfs+json";
115
116
117
118
119
120 public static final String HDR_APPLICATION_OCTET_STREAM = "application/octet-stream";
121 }