Class StringReader
- java.lang.Object
-
- org.openjdk.jmc.flightrecorder.internal.parser.v0.StringReader
-
- All Implemented Interfaces:
IValueReader
final class StringReader extends java.lang.Object implements IValueReader
Reads a string
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
CHARSET
static StringReader
INSTANCE
private static int
STRING_ELEMENT_SIZE
private static int
UNREASONABLE_STRING_LENGTH
-
Constructor Summary
Constructors Constructor Description StringReader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ContentType<?>
getValueType()
static java.lang.String
readString(byte[] data, Offset offset)
private static int
readStringByteCount(byte[] data, Offset offset)
java.lang.Object
readValue(byte[] data, Offset offset, long timestamp)
Reads an objects from a byte array starting at a given offset.
-
-
-
Field Detail
-
INSTANCE
public static final StringReader INSTANCE
-
STRING_ELEMENT_SIZE
private static final int STRING_ELEMENT_SIZE
- See Also:
- Constant Field Values
-
CHARSET
private static final java.lang.String CHARSET
- See Also:
- Constant Field Values
-
UNREASONABLE_STRING_LENGTH
private static final int UNREASONABLE_STRING_LENGTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
readValue
public java.lang.Object readValue(byte[] data, Offset offset, long timestamp) throws InvalidJfrFileException
Description copied from interface:IValueReader
Reads an objects from a byte array starting at a given offset.- Specified by:
readValue
in interfaceIValueReader
offset
- the offset to start read from. Will be moved to the end of the parsed datatimestamp
- the timestamp of the object to read- Returns:
- the parsed object
- Throws:
InvalidJfrFileException
-
readString
public static java.lang.String readString(byte[] data, Offset offset) throws InvalidJfrFileException
- Throws:
InvalidJfrFileException
-
readStringByteCount
private static int readStringByteCount(byte[] data, Offset offset) throws InvalidJfrFileException
- Throws:
InvalidJfrFileException
-
getValueType
public ContentType<?> getValueType()
- Specified by:
getValueType
in interfaceIValueReader
- Returns:
- the content type of the created objects
-
-