Class Offset
- java.lang.Object
-
- org.openjdk.jmc.flightrecorder.internal.parser.v0.Offset
-
class Offset extends java.lang.ObjectRepresents a pointer into a limited extent within an array of byte data.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.
-
-
Field Summary
Fields Modifier and Type Field Description private intoffsetprivate intoffsetLimit
-
Constructor Summary
Constructors Constructor Description Offset(byte[] data, int startOffset)Constructs a instance by reading the part length from an array of data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) intget()Get the current offset.(package private) intgetAndIncrease(int amount)Get the current offset and then increase it.(package private) intgetEnd()Get the permitted offset limit.(package private) voidincrease(int amount)Increase the offset.
-
-
-
Constructor Detail
-
Offset
Offset(byte[] data, int startOffset) throws InvalidJfrFileExceptionConstructs a instance by reading the part length from an array of data.- Parameters:
data- the data to read the length fromstartOffset- the position where the extent starts- Throws:
InvalidJfrFileException- if the permitted limit would be after the end of the data array
-
-
Method Detail
-
increase
void increase(int amount) throws InvalidJfrFileExceptionIncrease the offset.- Parameters:
amount- amount to increase the offset with- Throws:
InvalidJfrFileException- if the offset is increased beyond the permitted limit
-
get
int get()
Get the current offset.- Returns:
- the current offset
-
getAndIncrease
int getAndIncrease(int amount) throws InvalidJfrFileExceptionGet the current offset and then increase it.- Parameters:
amount- amount to increase the offset with- Returns:
- the current offset, before incrementing it
- Throws:
InvalidJfrFileException- if the offset is increased beyond the permitted limit
-
getEnd
int getEnd()
Get the permitted offset limit.- Returns:
- the offset limit
-
-