Class Chunk
- java.lang.Object
-
- org.openjdk.jmc.flightrecorder.internal.parser.Chunk
-
public class Chunk extends Object
Class for handling data belonging to a single chunk.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
fill(long upToPosition)
Copy data from the input source to the chunk buffer.short
getMajorVersion()
short
getMinorVersion()
int
getPosition()
byte[]
getReusableBuffer()
Return the current data buffer.void
skip(long upToPosition)
Skip reading data from the input source up to a specified position.
-
-
-
Constructor Detail
-
Chunk
public Chunk(DataInput input, int offset, byte[] reusableBuffer) throws IOException, org.openjdk.jmc.flightrecorder.internal.InvalidJfrFileException
- Parameters:
input
- input to read chunk data fromoffset
- initial positionreusableBuffer
- a byte array for holding read chunk data- Throws:
IOException
org.openjdk.jmc.flightrecorder.internal.InvalidJfrFileException
-
-
Method Detail
-
getMajorVersion
public short getMajorVersion()
-
getMinorVersion
public short getMinorVersion()
-
getPosition
public int getPosition()
-
fill
public byte[] fill(long upToPosition) throws IOException, org.openjdk.jmc.flightrecorder.internal.InvalidJfrFileException
Copy data from the input source to the chunk buffer. Note that this may replace the buffer if it is not large enough.- Parameters:
upToPosition
- position to fill buffer to- Returns:
- the current buffer for the chunk data
- Throws:
IOException
org.openjdk.jmc.flightrecorder.internal.InvalidJfrFileException
-
skip
public void skip(long upToPosition) throws IOException, org.openjdk.jmc.flightrecorder.internal.InvalidJfrFileException
Skip reading data from the input source up to a specified position. Note that the skipped data can not be read later from the same input source.- Parameters:
upToPosition
- chunk relative position- Throws:
IOException
org.openjdk.jmc.flightrecorder.internal.InvalidJfrFileException
-
getReusableBuffer
public byte[] getReusableBuffer()
Return the current data buffer. Note that the returned array is only guaranteed to contain data up to the read position when this method is called. If the buffer is filled more later, then that data may end up in a new array.- Returns:
- the current chunk data buffer
-
-