Package org.eclipse.jgit.util
Class Base85
- java.lang.Object
-
- org.eclipse.jgit.util.Base85
-
public final class Base85 extends Object
Base-85 encoder/decoder.- Since:
- 5.12
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
decode(byte[] encoded, int expectedSize)
Decodes the Base-85encoded
data into a byte array ofexpectedSize
bytes.static byte[]
decode(byte[] encoded, int start, int length, int expectedSize)
Decodeslength
bytes of Base-85encoded
data, beginning at thestart
index, into a byte array ofexpectedSize
bytes.static byte[]
encode(byte[] data)
Encodes the givendata
in Base-85.static byte[]
encode(byte[] data, int start, int length)
Encodeslength
bytes ofdata
in Base-85, beginning at thestart
index.static int
encodedLength(int rawLength)
Determines the length of the base-85 encoding forrawLength
bytes.
-
-
-
Method Detail
-
encodedLength
public static int encodedLength(int rawLength)
Determines the length of the base-85 encoding forrawLength
bytes.- Parameters:
rawLength
- number of bytes to encode- Returns:
- number of bytes needed for the base-85 encoding of
rawLength
bytes
-
encode
public static byte[] encode(byte[] data)
Encodes the givendata
in Base-85.- Parameters:
data
- to encode- Returns:
- encoded data
-
encode
public static byte[] encode(byte[] data, int start, int length)
Encodeslength
bytes ofdata
in Base-85, beginning at thestart
index.- 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-85encoded
data into a byte array ofexpectedSize
bytes.- 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)
Decodeslength
bytes of Base-85encoded
data, beginning at thestart
index, into a byte array ofexpectedSize
bytes.- Parameters:
encoded
- Base-85 encoded datastart
- index at which the data to decode starts inencoded
length
- of the Base-85 encoded dataexpectedSize
- of the result- Returns:
- the decoded bytes
- Throws:
IllegalArgumentException
- if expectedSize doesn't match,length
is not a multiple of 5, or there are invalid characters in the encoded data
-
-