ILXBufferUtil¶
new ILXBufferUtil()
- Since:
- BIP-IP TMOS 13.0
The ILXBufferUtil Class provides F5 implemented commands to do common operations on buffers, s pecifically including:
- Search: Find matching bytes
- Replace: Find and replace bytes
- ReplaceAt: Replace some subsection with bytes
- Insert: Insert new bytes
- Append: Append bytes
- Erase: Erase some subsection
Note: The ILXBufferUtil class has already been instantiated in the f5-nodejs module, therefore methods can be used directly from the ILXBufferUtil object. See examples below.
Example:
var f5 = require('f5-nodejs');
var buffToBeSeached = new Buffer('010203040506', 'hex');
var seachBytes = new Buffer('03', 'hex');
// Search for first occurance of seachBytes in buffToBeSeached
var result2 = f5.ILXBufferUtil.search(buffToBeSeached, seachBytes);
console.log('Found at idx:', result1); // Outputs "Found at idx: 2"
Methods¶
append(buf, bytes)→ {buffer}¶
Parameters:¶
Name | Type | Description |
---|---|---|
buf
|
buffer | source buffer |
bytes
|
string | buffer | byte sequence to append |
Returns:¶
Type | Description |
---|---|
buffer | new buffer with the appended byte sequence |
erase(buf, offset, len)→ {buffer}¶
Parameters:¶
Name | Type | Description |
---|---|---|
buf
|
buffer | source buffer |
offset
|
number | offset of the byte sequence to erase |
len
|
number | length of the byte sequence to erase |
Returns:¶
Type | Description |
---|---|
buffer | new buffer with the erased chunk |
insert(buf, bytes, offset)→ {buffer}¶
Parameters:¶
Name | Type | Description |
---|---|---|
buf
|
buffer | source buffer |
bytes
|
string | buffer | byte sequence to insert |
offset
|
number | offset where to insert the byte sequence to |
Returns:¶
Type | Description |
---|---|
buffer | new modified buffer with the inserted byte sequence |
replace(buffer, old, repl, result, [options])→ {buffer}¶
Parameters:¶
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
buffer
|
buffer | source buffer | |||||||||
old
|
string | buffer | byte sequence or string to replace | |||||||||
repl
|
string | buffer | byte sequence of string to replace with | |||||||||
result
|
objecT | the result object where to put the replace results to Pro
rties
|
|||||||||
options
|
object | <optional> | search options/options Pro
rties-1 +—+—+—+– -+—+ | N | T | A | D
a | y | t | e
| e |
m | p | t | f
| s |
e | e | r | a
| c |
| | i | u
| r |
| | b | l
| i |
| | u | t
| p |
| | t |
| t |
| | e |
| i |
| | s |
| o |
| | |
| n |
+===+===+===+== =+===+ | : | n | < | 0
: | u | o |
| f |
| m | p |
| f |
| b | t |
| s |
| e | i |
| e |
| r | o |
| t |
o | | n |
| t |
f | | a |
| o |
f | | l |
| s |
s | | > |
| t |
e | | |
| a |
t | | |
| r |
| | |
| t |
| | |
| s |
| | |
| e |
| | |
| a |
| | |
| r |
| | |
| c |
| | |
| h |
| | |
| f |
| | |
| r |
| | |
| o |
| | |
| m |
+—+—+—+– -+—+ | : | b | < | f
: | o | o | a
| e |
| o | p | l
| p |
| l | t | s
| l |
| e | i | e
| a |
| a | o |
| c |
a | n | n |
| e |
l | | a |
| a |
l | | l |
| l |
| | > |
| l |
| | |
| m |
| | |
| a |
| | |
| t |
| | |
| c |
| | |
| h |
| | |
| e |
| | |
| s |
| | |
| . |
| | |
| F |
| | |
| i |
| | |
| r |
| | |
| s |
| | |
| t |
| | |
| o |
| | |
| n |
| | |
| e |
| | |
| o |
| | |
| t |
| | |
| h |
| | |
| e |
| | |
| r |
| | |
| w |
| | |
| i |
| | |
| s |
| | |
| e |
| | |
| . |
+—+—+—+– -+—+ | : | b | < | f
: | o | o | a
| e |
| o | p | l
| r |
| l | t | s
| f |
| e | i | e
| o |
| a | o |
| r |
i | n | n |
| m |
c | | a |
| c |
a | | l |
| a |
s | | > |
| s |
e | | |
| e |
| | |
| i |
| | |
| n |
| | |
| s |
| | |
| e |
| | |
| n |
| | |
| s |
| | |
| i |
| | |
| t |
| | |
| i |
| | |
| v |
| | |
| e |
| | |
| s |
| | |
| e |
| | |
| a |
| | |
| r |
| | |
| c |
| | |
| h |
+—+—+—+– -+—+ |
Returns:¶
Type | Description |
---|---|
buffer |
|
replaceAt(buffer, repl, offset, [options])→ {buffer}¶
Parameters:¶
Name | Type | Attributes | Description | ||
---|---|---|---|---|---|
buffer
|
buffer | source buffer | |||
repl
|
string | buffer | byte sequence or string to replace | |||
offset
|
number | offset of the start position | |||
options
|
object | <optional> | replace options Pro
rties-2 +—+—+—+– -+—+ | N | T | A | D
a | y | t | e
| e |
m | p | t | f
| s |
e | e | r | a
| c |
| | i | u
| r |
| | b | l
| i |
| | u | t
| p |
| | t |
| t |
| | e |
| i |
| | s |
| o |
| | |
| n |
+===+===+===+== =+===+ | : | n | < | e
: | u | o | n
| e |
| m | p | d
| n |
| b | t | o
| g |
| e | i | f
| t |
| r | o | b
| h |
l | | n | u
| o |
e | | a | f
| f |
n | | l | f
| t |
g | | > | e
| h |
t | | | r
| e |
h | | |
| b |
| | |
| y |
| | |
| t |
| | |
| e |
| | |
| s |
| | |
| e |
| | |
| q |
| | |
| u |
| | |
| e |
| | |
| n |
| | |
| c |
| | |
| e |
| | |
| t |
| | |
| o |
| | |
| r |
| | |
| e |
| | |
| p |
| | |
| l |
| | |
| a |
| | |
| c |
| | |
| e |
+—+—+—+– -+—+ |
Returns:¶
Type | Description |
---|---|
buffer | new buffer with the replaced byte sequence. |
rsearch(buffer, bytes, options)→ {number}¶
Parameters:¶
Name | Type | Description | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
buffer
|
buffer | source buffer | |||||||||||||||||
bytes
|
string | buffer | byte sequence or string to search for | |||||||||||||||||
options
|
object | search options Propertie
3
|
Returns:¶
Type | Description |
---|---|
number | -1 or the index found at |
search(buffer, bytes, [options])→ {number}¶
Parameters:¶
Name | Type | Attributes | Description | ||
---|---|---|---|---|---|
buffer
|
buffer | source buffer | |||
bytes
|
string | buffer | byte sequence or string to search for | |||
options
|
object | <optional> | search options Pro
rties-4 +—+—+—+– -+—+ | N | T | A | D
a | y | t | e
| e |
m | p | t | f
| s |
e | e | r | a
| c |
| | i | u
| r |
| | b | l
| i |
| | u | t
| p |
| | t |
| t |
| | e |
| i |
| | s |
| o |
| | |
| n |
+===+===+===+== =+===+ | : | n | < | 0
: | u | o |
| f |
| m | p |
| f |
| b | t |
| s |
| e | i |
| e |
| r | o |
| t |
o | | n |
| t |
f | | a |
| o |
f | | l |
| s |
s | | > |
| t |
e | | |
| a |
t | | |
| r |
| | |
| t |
| | |
| s |
| | |
| e |
| | |
| a |
| | |
| r |
| | |
| c |
| | |
| h |
| | |
| f |
| | |
| r |
| | |
| o |
| | |
| m |
+—+—+—+– -+—+ | : | b | < | f
: | o | o | a
| e |
| o | p | l
| r |
| l | t | s
| f |
| e | i | e
| o |
| a | o |
| r |
i | n | n |
| m |
c | | a |
| c |
a | | l |
| a |
s | | > |
| s |
e | | |
| e |
| | |
| i |
| | |
| n |
| | |
| s |
| | |
| e |
| | |
| n |
| | |
| s |
| | |
| i |
| | |
| t |
| | |
| i |
| | |
| v |
| | |
| e |
| | |
| s |
| | |
| e |
| | |
| a |
| | |
| r |
| | |
| c |
| | |
| h |
+—+—+—+– -+—+ |
Returns:¶
Type | Description |
---|---|
number | -1 or the index found at |
The BIG-IP API Reference documentation contains community-contributed content. F5 does not monitor or control community code contributions. We make no guarantees or warranties regarding the available code, and it may contain errors, defects, bugs, inaccuracies, or security vulnerabilities. Your access to and use of any code available in the BIG-IP API reference guides is solely at your own risk.