Class Chunk
- java.lang.Object
-
- org.openjdk.jmc.flightrecorder.internal.parser.Chunk
-
public class Chunk extends java.lang.ObjectClass for handling data belonging to a single chunk.
-
-
Constructor Summary
Constructors Constructor Description Chunk(java.io.DataInput input, int offset, byte[] reusableBuffer)
-
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.shortgetMajorVersion()shortgetMinorVersion()intgetPosition()byte[]getReusableBuffer()Return the current data buffer.voidskip(long upToPosition)Skip reading data from the input source up to a specified position.
-
-
-
Constructor Detail
-
Chunk
public Chunk(java.io.DataInput input, int offset, byte[] reusableBuffer) throws java.io.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:
java.io.IOExceptionorg.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 java.io.IOException, org.openjdk.jmc.flightrecorder.internal.InvalidJfrFileExceptionCopy 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:
java.io.IOExceptionorg.openjdk.jmc.flightrecorder.internal.InvalidJfrFileException
-
skip
public void skip(long upToPosition) throws java.io.IOException, org.openjdk.jmc.flightrecorder.internal.InvalidJfrFileExceptionSkip 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:
java.io.IOExceptionorg.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
-
-