Package com.facilita.fc.web
Class OffsetEditSequence
- java.lang.Object
-
- com.facilita.fc.web.OffsetEditSequence
-
public class OffsetEditSequence extends java.lang.Object
Objects 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 theString
at the offset point, and the replacementString
inserted. The replacementString
can be a different length to the bytes removed.An
OffsetEditSequence
object 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 anOffsetEditSequence
object 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 void
add(int offset, int length, java.lang.String newValue)
Appends an edit instruction to replacelength
bytes, starting at positionoffset
, with the bytes contained innewValue
.void
clear()
Removes all of the edits in the sequence.void
delete()
static long
getCPtr(OffsetEditSequence obj)
For internal use only.long
size()
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 anOffsetEditSequence
object 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 replacelength
bytes, starting at positionoffset
, with the bytes contained innewValue
.- Parameters:
offset
- the offset in bytes from the beginning of the targetString
length
- the number of bytes to replacenewValue
- the newString
to 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.
-
-