Package org.eclipse.jgit.util
Class Base85
java.lang.Object
org.eclipse.jgit.util.Base85
Base-85 encoder/decoder.
- Since:
- 5.12
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]decode(byte[] encoded, int expectedSize) Decodes the Base-85encodeddata into a byte array ofexpectedSizebytes.static byte[]decode(byte[] encoded, int start, int length, int expectedSize) Decodeslengthbytes of Base-85encodeddata, beginning at thestartindex, into a byte array ofexpectedSizebytes.static byte[]encode(byte[] data) Encodes the givendatain Base-85.static byte[]encode(byte[] data, int start, int length) Encodeslengthbytes ofdatain Base-85, beginning at thestartindex.static intencodedLength(int rawLength) Determines the length of the base-85 encoding forrawLengthbytes.
-
Field Details
-
ENCODE
private static final byte[] ENCODE -
DECODE
private static final int[] DECODE
-
-
Constructor Details
-
Base85
private Base85()
-
-
Method Details
-
encodedLength
public static int encodedLength(int rawLength) Determines the length of the base-85 encoding forrawLengthbytes.- Parameters:
rawLength- number of bytes to encode- Returns:
- number of bytes needed for the base-85 encoding of
rawLengthbytes
-
encode
public static byte[] encode(byte[] data) Encodes the givendatain Base-85.- Parameters:
data- to encode- Returns:
- encoded data
-
encode
public static byte[] encode(byte[] data, int start, int length) Encodeslengthbytes ofdatain Base-85, beginning at thestartindex.- Parameters:
data- to encodestart- index of the first byte to encodelength- number of bytes to encode- Returns:
- encoded data
-
decode
public static byte[] decode(byte[] encoded, int expectedSize) Decodes the Base-85encodeddata into a byte array ofexpectedSizebytes.- Parameters:
encoded- Base-85 encoded dataexpectedSize- of the result- Returns:
- the decoded bytes
- Throws:
IllegalArgumentException- if expectedSize doesn't match, the encoded data has a length that is not a multiple of 5, or there are invalid characters in the encoded data
-
decode
public static byte[] decode(byte[] encoded, int start, int length, int expectedSize) Decodeslengthbytes of Base-85encodeddata, beginning at thestartindex, into a byte array ofexpectedSizebytes.- Parameters:
encoded- Base-85 encoded datastart- index at which the data to decode starts inencodedlength- of the Base-85 encoded dataexpectedSize- of the result- Returns:
- the decoded bytes
- Throws:
IllegalArgumentException- if expectedSize doesn't match,lengthis not a multiple of 5, or there are invalid characters in the encoded data
-