Top Description Fields Constructors Methods
org.eclipse.jgit.util

public final Class Base85

extends Object
Class Inheritance
Imports
java.nio.charset.StandardCharsets, java.text.MessageFormat, java.util.Arrays, org.eclipse.jgit.internal.JGitText

Base-85 encoder/decoder.
Since
5.12

Field Summary

Modifier and TypeField and Description
private static final int[]
private static final byte[]

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static byte[]

Returns:

the decoded bytes
decode
(byte[]
Base-85 encoded data
encoded
,
int
of the result
expectedSize
)

Decodes the Base-85 encoded data into a byte array of expectedSize bytes.

public static byte[]

Returns:

the decoded bytes
decode
(byte[]
Base-85 encoded data
encoded
,
int
index at which the data to decode starts in encoded
start
,
int
of the Base-85 encoded data
length
,
int
of the result
expectedSize
)

Decodes length bytes of Base-85 encoded data, beginning at the start index, into a byte array of expectedSize bytes.

public static byte[]

Returns:

encoded data
encode
(byte[]
to encode
data
)

Encodes the given data in Base-85.

public static byte[]

Returns:

encoded data
encode
(byte[]
to encode
data
,
int
index of the first byte to encode
start
,
int
number of bytes to encode
length
)

Encodes length bytes of data in Base-85, beginning at the start index.

public static int

Returns:

number of bytes needed for the base-85 encoding of rawLength bytes
encodedLength
(int
number of bytes to encode
rawLength
)

Determines the length of the base-85 encoding for rawLength bytes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DECODEback to summary
private static final int[] DECODE
ENCODEback to summary
private static final byte[] ENCODE

Constructor Detail

Base85back to summary
private Base85()

Method Detail

decodeback to summary
public static byte[] decode(byte[] encoded, int expectedSize)

Decodes the Base-85 encoded data into a byte array of expectedSize bytes.

Parameters
encoded:byte[]

Base-85 encoded data

expectedSize:int

of the result

Returns:byte[]

the decoded bytes

Exceptions
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
decodeback to summary
public static byte[] decode(byte[] encoded, int start, int length, int expectedSize)

Decodes length bytes of Base-85 encoded data, beginning at the start index, into a byte array of expectedSize bytes.

Parameters
encoded:byte[]

Base-85 encoded data

start:int

index at which the data to decode starts in encoded

length:int

of the Base-85 encoded data

expectedSize:int

of the result

Returns:byte[]

the decoded bytes

Exceptions
IllegalArgumentException:
if expectedSize doesn't match, length is not a multiple of 5, or there are invalid characters in the encoded data
encodeback to summary
public static byte[] encode(byte[] data)

Encodes the given data in Base-85.

Parameters
data:byte[]

to encode

Returns:byte[]

encoded data

encodeback to summary
public static byte[] encode(byte[] data, int start, int length)

Encodes length bytes of data in Base-85, beginning at the start index.

Parameters
data:byte[]

to encode

start:int

index of the first byte to encode

length:int

number of bytes to encode

Returns:byte[]

encoded data

encodedLengthback to summary
public static int encodedLength(int rawLength)

Determines the length of the base-85 encoding for rawLength bytes.

Parameters
rawLength:int

number of bytes to encode

Returns:int

number of bytes needed for the base-85 encoding of rawLength bytes