Interface ByteArray
-
Method Summary
Modifier and TypeMethodDescriptionstatic ByteArraybyteArray(byte... data) Create a newByteArraywith the provided byte data.static ByteArraybyteArray(int... data) Create a newByteArraywith the provided integers after a narrowing primitive conversion to bytes.static ByteArrayCreate a newByteArrayfrom the provided text using the encoding specified by Burp Suite.static ByteArraybyteArrayOfLength(int length) Create a newByteArraywith the provided length.copy()Create a copy of theByteArrayCreate a copy of theByteArrayin temporary file.
This method is used to save theByteArrayobject to a temporary file, so that it is no longer held in memory.intcountMatches(ByteArray searchTerm) Searches the data in the ByteArray and counts all matches for a specified term.intcountMatches(ByteArray searchTerm, boolean caseSensitive) Searches the data in the ByteArray and counts all matches for a specified term.intcountMatches(ByteArray searchTerm, boolean caseSensitive, int startIndexInclusive, int endIndexExclusive) Searches the data in the ByteArray and counts all matches for a specified term.intcountMatches(String searchTerm) Searches the data in the ByteArray and counts all matches for a specified term.intcountMatches(String searchTerm, boolean caseSensitive) Searches the data in the ByteArray and counts all matches for a specified term.intcountMatches(String searchTerm, boolean caseSensitive, int startIndexInclusive, int endIndexExclusive) Searches the data in the ByteArray and counts all matches for a specified term.intcountMatches(Pattern pattern) Searches the data in the ByteArray and counts all matches for a specified pattern.intcountMatches(Pattern pattern, int startIndexInclusive, int endIndexExclusive) Searches the data in the ByteArray and counts all matches for a specified pattern.bytegetByte(int index) Access the byte stored at the provided index.byte[]getBytes()Copy of all bytesintSearches the data in the ByteArray for the first occurrence of a specified term.intSearches the data in the ByteArray for the first occurrence of a specified term.intindexOf(ByteArray searchTerm, boolean caseSensitive, int startIndexInclusive, int endIndexExclusive) Searches the data in the ByteArray for the first occurrence of a specified term.intSearches the data in the ByteArray for the first occurrence of a specified term.intSearches the data in the ByteArray for the first occurrence of a specified term.intSearches the data in the ByteArray for the first occurrence of a specified term.intSearches the data in the ByteArray for the first occurrence of a specified pattern.intSearches the data in the ByteArray for the first occurrence of a specified pattern.intlength()Number of bytes stored in theByteArray.voidsetByte(int index, byte value) Sets the byte at the provided index to the provided byte.voidsetByte(int index, int value) Sets the byte at the provided index to the provided narrowed integer value.voidsetBytes(int index, byte... data) Sets bytes starting at the specified index to the provided bytes.voidsetBytes(int index, int... data) Sets bytes starting at the specified index to the provided integers after narrowing primitive conversion to bytes.voidSets bytes starting at the specified index to the provided bytes.subArray(int startIndexInclusive, int endIndexExclusive) New ByteArray with all bytes between the start index (inclusive) and the end index (exclusive).New ByteArray with all bytes in the specified range.toString()Convert the bytes of the ByteArray into String form using the encoding specified by Burp Suite.withAppended(byte... data) Create a copy of theByteArrayappended with the provided bytes.withAppended(int... data) Create a copy of theByteArrayappended with the provided integers after narrowing primitive conversion to bytes.withAppended(ByteArray byteArray) Create a copy of theByteArrayappended with the provided ByteArray.withAppended(String text) Create a copy of theByteArrayappended with the provided text as bytes.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
getByte
byte getByte(int index) Access the byte stored at the provided index.- Parameters:
index- Index of the byte to be retrieved.- Returns:
- The byte at the index.
-
setByte
void setByte(int index, byte value) Sets the byte at the provided index to the provided byte.- Parameters:
index- Index of the byte to be set.value- The byte to be set.
-
setByte
void setByte(int index, int value) Sets the byte at the provided index to the provided narrowed integer value.- Parameters:
index- Index of the byte to be set.value- The integer value to be set after a narrowing primitive conversion to a byte.
-
setBytes
void setBytes(int index, byte... data) Sets bytes starting at the specified index to the provided bytes.- Parameters:
index- The index of the first byte to set.data- The byte[] or sequence of bytes to be set.
-
setBytes
void setBytes(int index, int... data) Sets bytes starting at the specified index to the provided integers after narrowing primitive conversion to bytes.- Parameters:
index- The index of the first byte to set.data- The int[] or the sequence of integers to be set after a narrowing primitive conversion to bytes.
-
setBytes
Sets bytes starting at the specified index to the provided bytes.- Parameters:
index- The index of the first byte to set.byteArray- TheByteArrayobject holding the provided bytes.
-
length
int length()Number of bytes stored in theByteArray.- Returns:
- Length of the
ByteArray.
-
getBytes
byte[] getBytes()Copy of all bytes- Returns:
- Copy of all bytes.
-
subArray
New ByteArray with all bytes between the start index (inclusive) and the end index (exclusive).- Parameters:
startIndexInclusive- The inclusive start index of retrieved range.endIndexExclusive- The exclusive end index of retrieved range.- Returns:
- ByteArray containing all bytes in the specified range.
-
subArray
-
copy
ByteArray copy()Create a copy of theByteArray- Returns:
- New
ByteArraywith a copy of the wrapped bytes.
-
copyToTempFile
ByteArray copyToTempFile()Create a copy of theByteArrayin temporary file.
This method is used to save theByteArrayobject to a temporary file, so that it is no longer held in memory. Extensions can use this method to convertByteArrayobjects into a form suitable for long-term usage.- Returns:
- A new
ByteArrayinstance stored in temporary file.
-
indexOf
Searches the data in the ByteArray for the first occurrence of a specified term. It works on byte-based data in a way that is similar to the way the native Java methodString.indexOf(String)works on String-based data.- Parameters:
searchTerm- The value to be searched for.- Returns:
- The offset of the first occurrence of the pattern within the specified bounds, or -1 if no match is found.
-
indexOf
Searches the data in the ByteArray for the first occurrence of a specified term. It works on byte-based data in a way that is similar to the way the native Java methodString.indexOf(String)works on String-based data.- Parameters:
searchTerm- The value to be searched for.- Returns:
- The offset of the first occurrence of the pattern within the specified bounds, or -1 if no match is found.
-
indexOf
Searches the data in the ByteArray for the first occurrence of a specified term. It works on byte-based data in a way that is similar to the way the native Java methodString.indexOf(String)works on String-based data.- Parameters:
searchTerm- The value to be searched for.caseSensitive- Flags whether the search is case-sensitive.- Returns:
- The offset of the first occurrence of the pattern within the specified bounds, or -1 if no match is found.
-
indexOf
Searches the data in the ByteArray for the first occurrence of a specified term. It works on byte-based data in a way that is similar to the way the native Java methodString.indexOf(String)works on String-based data.- Parameters:
searchTerm- The value to be searched for.caseSensitive- Flags whether the search is case-sensitive.- Returns:
- The offset of the first occurrence of the pattern within the specified bounds, or -1 if no match is found.
-
indexOf
int indexOf(ByteArray searchTerm, boolean caseSensitive, int startIndexInclusive, int endIndexExclusive) Searches the data in the ByteArray for the first occurrence of a specified term. It works on byte-based data in a way that is similar to the way the native Java methodString.indexOf(String)works on String-based data.- Parameters:
searchTerm- The value to be searched for.caseSensitive- Flags whether the search is case-sensitive.startIndexInclusive- The inclusive start index for the search.endIndexExclusive- The exclusive end index for the search.- Returns:
- The offset of the first occurrence of the pattern within the specified bounds, or -1 if no match is found.
-
indexOf
int indexOf(String searchTerm, boolean caseSensitive, int startIndexInclusive, int endIndexExclusive) Searches the data in the ByteArray for the first occurrence of a specified term. It works on byte-based data in a way that is similar to the way the native Java methodString.indexOf(String)works on String-based data.- Parameters:
searchTerm- The value to be searched for.caseSensitive- Flags whether the search is case-sensitive.startIndexInclusive- The inclusive start index for the search.endIndexExclusive- The exclusive end index for the search.- Returns:
- The offset of the first occurrence of the pattern within the specified bounds, or -1 if no match is found.
-
indexOf
Searches the data in the ByteArray for the first occurrence of a specified pattern.- Parameters:
pattern- The pattern to be matched.- Returns:
- The offset of the first occurrence of the pattern within the specified bounds, or -1 if no match is found.
-
indexOf
Searches the data in the ByteArray for the first occurrence of a specified pattern.- Parameters:
pattern- The pattern to be matched.startIndexInclusive- The inclusive start index for the search.endIndexExclusive- The exclusive end index for the search.- Returns:
- The offset of the first occurrence of the pattern within the specified bounds, or -1 if no match is found.
-
countMatches
Searches the data in the ByteArray and counts all matches for a specified term.- Parameters:
searchTerm- The value to be searched for.- Returns:
- The count of all matches of the pattern.
-
countMatches
Searches the data in the ByteArray and counts all matches for a specified term.- Parameters:
searchTerm- The value to be searched for.- Returns:
- The count of all matches of the pattern.
-
countMatches
Searches the data in the ByteArray and counts all matches for a specified term.- Parameters:
searchTerm- The value to be searched for.caseSensitive- Flags whether the search is case-sensitive.- Returns:
- The count of all matches of the pattern.
-
countMatches
Searches the data in the ByteArray and counts all matches for a specified term.- Parameters:
searchTerm- The value to be searched for.caseSensitive- Flags whether the search is case-sensitive.- Returns:
- The count of all matches of the pattern.
-
countMatches
int countMatches(ByteArray searchTerm, boolean caseSensitive, int startIndexInclusive, int endIndexExclusive) Searches the data in the ByteArray and counts all matches for a specified term.- Parameters:
searchTerm- The value to be searched for.caseSensitive- Flags whether the search is case-sensitive.startIndexInclusive- The inclusive start index for the search.endIndexExclusive- The exclusive end index for the search.- Returns:
- The count of all matches of the pattern within the specified bounds.
-
countMatches
int countMatches(String searchTerm, boolean caseSensitive, int startIndexInclusive, int endIndexExclusive) Searches the data in the ByteArray and counts all matches for a specified term.- Parameters:
searchTerm- The value to be searched for.caseSensitive- Flags whether the search is case-sensitive.startIndexInclusive- The inclusive start index for the search.endIndexExclusive- The exclusive end index for the search.- Returns:
- The count of all matches of the pattern within the specified bounds.
-
countMatches
Searches the data in the ByteArray and counts all matches for a specified pattern.- Parameters:
pattern- The pattern to be matched.- Returns:
- The count of all matches of the pattern within the specified bounds.
-
countMatches
Searches the data in the ByteArray and counts all matches for a specified pattern.- Parameters:
pattern- The pattern to be matched.startIndexInclusive- The inclusive start index for the search.endIndexExclusive- The exclusive end index for the search.- Returns:
- The count of all matches of the pattern within the specified bounds.
-
toString
-
withAppended
Create a copy of theByteArrayappended with the provided bytes.- Parameters:
data- The byte[] or sequence of bytes to append.
-
withAppended
Create a copy of theByteArrayappended with the provided integers after narrowing primitive conversion to bytes.- Parameters:
data- The int[] or sequence of integers to append after narrowing primitive conversion to bytes.
-
withAppended
-
withAppended
-
byteArrayOfLength
Create a newByteArraywith the provided length.- Parameters:
length- array length.- Returns:
- New
ByteArraywith the provided length.
-
byteArray
Create a newByteArraywith the provided byte data.- Parameters:
data- byte[] to wrap, or sequence of bytes to wrap.- Returns:
- New
ByteArraywrapping the provided byte array.
-
byteArray
Create a newByteArraywith the provided integers after a narrowing primitive conversion to bytes.- Parameters:
data- int[] to wrap or sequence of integers to wrap.- Returns:
- New
ByteArraywrapping the provided data after a narrowing primitive conversion to bytes.
-
byteArray
-