Top Description Constructors Methods
org.eclipse.jgit.internal.storage.pack

public Class BinaryDelta

extends Object
Class Inheritance
Imports
org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.util.QuotedString, .RawParseUtils

Recreate a stream from a base stream and a GIT pack delta.

This entire class is heavily cribbed from patch-delta.c in the GIT project. The original delta patching code was written by Nicolas Pitre (<[email protected]>).

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static final byte[]

Returns:

patched base
apply
(byte[]
some byte representing an object of some kind.
base
,
byte[]
a git pack delta defining the transform from one version to another.
delta
)

Apply the changes defined by delta to the data in base, yielding a new array of bytes.

public static final byte[]

Returns:

either result, or the result array allocated.
apply
(final byte[]
some byte representing an object of some kind.
base
,
final byte[]
a git pack delta defining the transform from one version to another.
delta
,
byte[]
array to store the result into. If null the result will be allocated and returned.
result
)

Apply the changes defined by delta to the data in base, yielding a new array of bytes.

public static String

Returns:

the formatted delta.
format
(byte[]
the delta instruction sequence to format.
delta
)

Format this delta as a human readable string.

public static String

Returns:

the formatted delta.
format
(byte[]
the delta instruction sequence to format.
delta
,
boolean
true if the header (base size and result size) should be included in the formatting.
includeHeader
)

Format this delta as a human readable string.

public static long

Returns:

the base object's size.
getBaseSize
(byte[]
the delta stream, or at least the header of it.
delta
)

Length of the base object in the delta stream.

public static long

Returns:

the resulting object's size.
getResultSize
(byte[]
the delta stream, or at least the header of it.
delta
)

Length of the resulting object in the delta stream.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

BinaryDeltaback to summary
public BinaryDelta()

Method Detail

applyback to summary
public static final byte[] apply(byte[] base, byte[] delta)

Apply the changes defined by delta to the data in base, yielding a new array of bytes.

Parameters
base:byte[]

some byte representing an object of some kind.

delta:byte[]

a git pack delta defining the transform from one version to another.

Returns:byte[]

patched base

applyback to summary
public static final byte[] apply(final byte[] base, final byte[] delta, byte[] result)

Apply the changes defined by delta to the data in base, yielding a new array of bytes.

Parameters
base:byte[]

some byte representing an object of some kind.

delta:byte[]

a git pack delta defining the transform from one version to another.

result:byte[]

array to store the result into. If null the result will be allocated and returned.

Returns:byte[]

either result, or the result array allocated.

formatback to summary
public static String format(byte[] delta)

Format this delta as a human readable string.

Parameters
delta:byte[]

the delta instruction sequence to format.

Returns:String

the formatted delta.

formatback to summary
public static String format(byte[] delta, boolean includeHeader)

Format this delta as a human readable string.

Parameters
delta:byte[]

the delta instruction sequence to format.

includeHeader:boolean

true if the header (base size and result size) should be included in the formatting.

Returns:String

the formatted delta.

getBaseSizeback to summary
public static long getBaseSize(byte[] delta)

Length of the base object in the delta stream.

Parameters
delta:byte[]

the delta stream, or at least the header of it.

Returns:long

the base object's size.

getResultSizeback to summary
public static long getResultSize(byte[] delta)

Length of the resulting object in the delta stream.

Parameters
delta:byte[]

the delta stream, or at least the header of it.

Returns:long

the resulting object's size.