Package com.facilita.fc.web
Class OffsetEditSequence
- java.lang.Object
-
- com.facilita.fc.web.OffsetEditSequence
-
public class OffsetEditSequence extends java.lang.ObjectObjects of this class contains a sequence of one or more edit instructions. Each instruction in turn replaces data at a particular offset in aString. A number of bytes is removed from theStringat the offset point, and the replacementStringinserted. The replacementStringcan be a different length to the bytes removed.An
OffsetEditSequenceobject is often used with theRequest.setMessageBodyFromFile(String)method to edit the contents of a data file used as post data in a POST request. It is useful when the POST data is very large or contains binary data, and must be edited dynamically during the test run.
-
-
Constructor Summary
Constructors Constructor Description OffsetEditSequence()Creates anOffsetEditSequenceobject with no edit instructions.OffsetEditSequence(long cPtr, boolean cMemoryOwn)For internal use only.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int offset, int length, java.lang.String newValue)Appends an edit instruction to replacelengthbytes, starting at positionoffset, with the bytes contained innewValue.voidclear()Removes all of the edits in the sequence.voiddelete()static longgetCPtr(OffsetEditSequence obj)For internal use only.longsize()Gets the number of edits in the sequence.
-
-
-
Constructor Detail
-
OffsetEditSequence
public OffsetEditSequence(long cPtr, boolean cMemoryOwn)For internal use only. Of no interest to the user.- Parameters:
cPtr- pointer to the CPP wrapped objectcMemoryOwn- indicates if this object is responsible for memory management of the CPP object
-
OffsetEditSequence
public OffsetEditSequence()
Creates anOffsetEditSequenceobject with no edit instructions.
-
-
Method Detail
-
getCPtr
public static long getCPtr(OffsetEditSequence obj)
For internal use only. Of no interest to the user.- Parameters:
obj- a reference to an object of this class- Returns:
- a long containing the address of the CPP wrapped object
-
delete
public void delete()
-
add
public void add(int offset, int length, java.lang.String newValue)Appends an edit instruction to replacelengthbytes, starting at positionoffset, with the bytes contained innewValue.- Parameters:
offset- the offset in bytes from the beginning of the targetStringlength- the number of bytes to replacenewValue- the newStringto insert
-
size
public long size()
Gets the number of edits in the sequence.- Returns:
- the number of edits in the sequence
-
clear
public void clear()
Removes all of the edits in the sequence.
-
-