Class 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 a String. A number of bytes is removed from the String at the offset point, and the replacement String inserted. The replacement String can be a different length to the bytes removed.

    An OffsetEditSequence object is often used with the Request.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 an OffsetEditSequence 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 replace length bytes, starting at position offset, with the bytes contained in newValue.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 object
        cMemoryOwn - indicates if this object is responsible for memory management of the CPP object
      • OffsetEditSequence

        public OffsetEditSequence()
        Creates an OffsetEditSequence 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 replace length bytes, starting at position offset, with the bytes contained in newValue.
        Parameters:
        offset - the offset in bytes from the beginning of the target String
        length - the number of bytes to replace
        newValue - the new String 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.