org.tmatesoft.svn.core.io.diff

Class SVNDiffInstruction


public class SVNDiffInstruction
extends Object

The SVNDiffInstruction class represents instructions used as delta applying rules.

For now there are three types of copy instructions:

These are three different ways how full text representation bytes are obtained.
Version:
1.1.1
Author:
TMate Software Ltd.

Field Summary

static int
COPY_FROM_NEW_DATA
A type of an instruction that says that data must be copied from the new data to the target view.
static int
COPY_FROM_SOURCE
A type of an instruction that says that data must be copied from the source view to the target one.
static int
COPY_FROM_TARGET
A type of an instruction that says that data must be copied from the target view to the target itself.
int
length
A length bytes to copy.
int
offset
An offset in the source from where the bytes should be copied.
int
type
A type of this instruction.

Constructor Summary

SVNDiffInstruction()
Creates a new instruction object.
SVNDiffInstruction(int t, int l, int o)
Creates a particular type of a diff instruction.

Method Summary

String
toString()
Gives a string representation of this object.
static void
writeInt(ByteBuffer os, int i)
Writes an integer to a byte buffer.
static void
writeLong(ByteBuffer os, long i)
Writes a long to a byte buffer.
void
writeTo(ByteBuffer target)
Wirtes this instruction to a byte buffer.

Field Details

COPY_FROM_NEW_DATA

public static final int COPY_FROM_NEW_DATA
A type of an instruction that says that data must be copied from the new data to the target view.
Field Value:
2

COPY_FROM_SOURCE

public static final int COPY_FROM_SOURCE
A type of an instruction that says that data must be copied from the source view to the target one.
Field Value:
0

COPY_FROM_TARGET

public static final int COPY_FROM_TARGET
A type of an instruction that says that data must be copied from the target view to the target itself.
Field Value:
1

length

public int length
A length bytes to copy.

offset

public int offset
An offset in the source from where the bytes should be copied. Instruction offsets are relative to the bounds of views, i.e. a source/target view is a window of bytes (specified in a concrete diff window) in the source/target stream (this can be a file, a buffer).

type

public int type
A type of this instruction.

Constructor Details

SVNDiffInstruction

public SVNDiffInstruction()
Creates a new instruction object. It's the instruction for the empty contents file.

SVNDiffInstruction

public SVNDiffInstruction(int t,
                          int l,
                          int o)
Creates a particular type of a diff instruction. Instruction offsets are relative to the bounds of views, i.e. a source/target view is a window of bytes (specified in a concrete diff window) in the source/target stream (this can be a file, a buffer).
Parameters:
t - a type of an instruction
l - a number of bytes to copy
o - an offset in the source (which may be a source or a target view, or a new data stream) from where the bytes are to be copied

Method Details

toString

public String toString()
Gives a string representation of this object.
Returns:
a string representation of this object

writeInt

public static void writeInt(ByteBuffer os,
                            int i)
Writes an integer to a byte buffer.
Parameters:
os - a byte buffer to write to
i - an integer to write

writeLong

public static void writeLong(ByteBuffer os,
                             long i)
Writes a long to a byte buffer.
Parameters:
os - a byte buffer to write to
i - a long number to write

writeTo

public void writeTo(ByteBuffer target)
Wirtes this instruction to a byte buffer.
Parameters:
target - a byte buffer to write to

Copyright © 2004-2006 TMate Software Ltd. All Rights Reserved.