class Offset
extends java.lang.Object
The offset instance is initialized by reading an integer value (4 bytes) at a specified position in the array. This value represents the maximum permitted number of bytes that may be read from the array starting from the start position.
The get and increase methods allow for tracking the current position in the array.
Modifier and Type | Field and Description |
---|---|
private int |
offset |
private int |
offsetLimit |
Constructor and Description |
---|
Offset(byte[] data,
int startOffset)
Constructs a instance by reading the part length from an array of data.
|
Modifier and Type | Method and Description |
---|---|
(package private) int |
get()
Get the current offset.
|
(package private) int |
getAndIncrease(int amount)
Get the current offset and then increase it.
|
(package private) int |
getEnd()
Get the permitted offset limit.
|
(package private) void |
increase(int amount)
Increase the offset.
|
Offset(byte[] data, int startOffset) throws InvalidJfrFileException
data
- the data to read the length fromstartOffset
- the position where the extent startsInvalidJfrFileException
- if the permitted limit would be after the end of the data arrayvoid increase(int amount) throws InvalidJfrFileException
amount
- amount to increase the offset withInvalidJfrFileException
- if the offset is increased beyond the permitted limitint get()
int getAndIncrease(int amount) throws InvalidJfrFileException
amount
- amount to increase the offset withInvalidJfrFileException
- if the offset is increased beyond the permitted limitint getEnd()