public class HighResolutionTimestamp extends Object implements Comparable<HighResolutionTimestamp>
Constructor and Description |
---|
HighResolutionTimestamp() |
Modifier and Type | Method and Description |
---|---|
void |
assemble(byte[] buffer,
int offset,
TimestampFormat format)
Assemble high resolution timestamp into specified buffer from specified offset with corresponding format.
|
int |
compareTo(HighResolutionTimestamp o) |
boolean |
equals(Object obj) |
LocalDateTime |
getLocalDateTime()
Returns timestamp without high resolution component of the high resolution timestamp.
|
long |
getPicoSecond()
Returns picosecond component of the high resolution timestamp.
|
static int |
getTimestampFormatLength(TimestampFormat format)
Returns length of timestamp corresponding to specified format.
|
void |
parse(byte[] buffer,
int offset,
int length,
TimestampFormat format)
Parses timestamp from byte array.
|
void |
setLocalDateTime(LocalDateTime localDateTime)
Sets timestamp without high resolution component of the high resolution timestamp.
|
void |
setPicoSecond(long picoSecond)
Sets picosecond component of the high resolution timestamp.
|
String |
toString() |
boolean |
tryParse(byte[] buffer,
int offset,
int length,
TimestampFormat format)
Tries to parse timestamp from byte array.
|
public LocalDateTime getLocalDateTime()
public void setLocalDateTime(LocalDateTime localDateTime)
localDateTime
- timestamp without high resolution component to be setpublic long getPicoSecond()
public void setPicoSecond(long picoSecond)
picoSecond
- picoseconds to be setpublic void parse(byte[] buffer, int offset, int length, TimestampFormat format) throws ParseException
buffer
- source bufferoffset
- offset in the source bufferlength
- length of the value in the source bufferformat
- timestamp format to be parsedNullPointerException
- if (null == buffer)
or (null == format)
IllegalArgumentException
- if (offset < 0)
or (offset + length > buffer.length)
ParseException
- if byte array can not be parsed with specified formatpublic boolean tryParse(byte[] buffer, int offset, int length, TimestampFormat format)
buffer
- source bufferoffset
- offset in the source bufferlength
- length of the value in the source bufferformat
- timestamp format to be parsedtrue
if timestamp successfully parsed, false
otherwise.NullPointerException
- if (null == buffer)
or (null == format)
IllegalArgumentException
- if (offset < 0)
or (offset + length > buffer.length)
public void assemble(byte[] buffer, int offset, TimestampFormat format)
buffer
- buffer to be used for assembleoffset
- offset in the buffer to be usedformat
- format to be used for assembleNullPointerException
- if (null == buffer)
or (null == format)
IllegalArgumentException
- if (offset + [format length] > buffer.length)
public static int getTimestampFormatLength(TimestampFormat format)
format
- format of timestamppublic int compareTo(HighResolutionTimestamp o)
compareTo
in interface Comparable<HighResolutionTimestamp>
Copyright © 2005–2024 Onix Solutions. All rights reserved.