Package io.deephaven.base.text
Class Convert
java.lang.Object
io.deephaven.base.text.Convert
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static int
the maximum number of bytes in the ASCII decimal representation of a double: 17 digits, decimal point, sign, 'E', exponentstatic int
the maximum number of bytes in the ASCII decimal representation of an integerstatic final int
the exact number of bytes in an ISO8601 millis timestamp: YYYY-MM-DDTHH:MM:SS.MMMstatic final int
the exact number of bytes in an ISO8601 micros timestamp: YYYY-MM-DDTHH:MM:SS.MMMstatic int
the maximum number of bytes in the ASCII decimal representation of a longstatic int
the maximum number of bytes in the ASCII decimal representation of an integer -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ByteBuffer
appendDouble
(double input, @NotNull ByteBuffer dest) Append a decimal representation of adouble
to aByteBuffer
.static ByteBuffer
appendInt
(int n, ByteBuffer b) Append a decimal representation of an integer to a byte buffer.static ByteBuffer
appendISO8601
(int year, int month, int day, int hour, int minute, int second, int millis, byte[] gmtOffsetSuffix, ByteBuffer b) Append an ISO 8601 representation of a broken-down time to a byte buffer.static ByteBuffer
appendISO8601Micros
(int year, int month, int day, int hour, int minute, int second, int millis, int micros, byte[] gmtOffsetSuffix, ByteBuffer b) Append an ISO 8601 representation of a broken-down time to a byte buffer.static ByteBuffer
appendISO8601Micros
(long t, byte[] gmtOffsetSuffix, ByteBuffer b) Append an ISO 8601 representation of micros-since-the-epoch timestamp to a byte buffer.static ByteBuffer
appendISO8601Millis
(long t, byte[] gmtOffsetSuffix, ByteBuffer b) Append an ISO 8601 representation of millis-since-the-epoch timestamp to a byte buffer.static ByteBuffer
appendLong
(long n, ByteBuffer b) Append a decimal representation of a long to a byte buffer.static ByteBuffer
appendShort
(short n, ByteBuffer b) Append a decimal representation of a short to a byte buffer.
-
Field Details
-
MAX_SHORT_BYTES
public static int MAX_SHORT_BYTESthe maximum number of bytes in the ASCII decimal representation of an integer -
MAX_INT_BYTES
public static int MAX_INT_BYTESthe maximum number of bytes in the ASCII decimal representation of an integer -
MAX_LONG_BYTES
public static int MAX_LONG_BYTESthe maximum number of bytes in the ASCII decimal representation of a long -
MAX_DOUBLE_BYTES
public static int MAX_DOUBLE_BYTESthe maximum number of bytes in the ASCII decimal representation of a double: 17 digits, decimal point, sign, 'E', exponent -
MAX_ISO8601_BYTES
public static final int MAX_ISO8601_BYTESthe exact number of bytes in an ISO8601 millis timestamp: YYYY-MM-DDTHH:MM:SS.MMM- See Also:
-
MAX_ISO8601_MICROS_BYTES
public static final int MAX_ISO8601_MICROS_BYTESthe exact number of bytes in an ISO8601 micros timestamp: YYYY-MM-DDTHH:MM:SS.MMM- See Also:
-
ISO8601_SECOND_OFFSET
public static final int ISO8601_SECOND_OFFSET- See Also:
-
ISO8601_MILLIS_OFFSET
public static final int ISO8601_MILLIS_OFFSET- See Also:
-
ISO8601_MICROS_OFFSET
public static final int ISO8601_MICROS_OFFSET- See Also:
-
-
Constructor Details
-
Convert
public Convert()
-
-
Method Details
-
appendShort
Append a decimal representation of a short to a byte buffer.- Parameters:
n
- the integer to be convertedb
- the byte buffer- Returns:
- the byte buffer
- Throws:
BufferOverflowException
- if there is not enough space in the buffer
-
appendInt
Append a decimal representation of an integer to a byte buffer.- Parameters:
n
- the integer to be convertedb
- the byte buffer- Returns:
- the byte buffer
- Throws:
BufferOverflowException
- if there is not enough space in the buffer
-
appendLong
Append a decimal representation of a long to a byte buffer.- Parameters:
n
- the long to be convertedb
- the byte buffer- Returns:
- the byte buffer
- Throws:
BufferOverflowException
- if there is not enough space in the buffer
-
appendDouble
Append a decimal representation of adouble
to aByteBuffer
. Works as ifDouble.toString(double)
were used.- Parameters:
input
- Thedouble
to be converteddest
- TheByteBuffer
- Returns:
dest
-
appendISO8601Millis
Append an ISO 8601 representation of millis-since-the-epoch timestamp to a byte buffer. The output length is always 23 bytes plus the length of the GMT offset suffix: YYYY-MM-DDTHH:MM:SS.MMM<suffix>.- Parameters:
t
- the timestamp to be converted, millis since 1970-01-01T00:00:00 GMTgmtOffsetSuffix
- the time zone suffix, or null for no suffixb
- the byte buffer- Returns:
- the byte buffer
- Throws:
BufferOverflowException
- if there is not enough space in the buffer
-
appendISO8601
public static ByteBuffer appendISO8601(int year, int month, int day, int hour, int minute, int second, int millis, byte[] gmtOffsetSuffix, ByteBuffer b) Append an ISO 8601 representation of a broken-down time to a byte buffer. The output length is always 23 bytes plus the length of the GMT offset suffix: YYYY-MM-DDTHH:MM:SS.MMM<suffix>.- Parameters:
year
- the yearmonth
- the monthday
- the day of the monthhour
- the hourminute
- the minutesecond
- the secondmillis
- the millisgmtOffsetSuffix
- the time zone suffix, or null for no suffixb
- the byte buffer- Returns:
- the byte buffer
- Throws:
BufferOverflowException
- if there is not enough space in the buffer
-
appendISO8601Micros
Append an ISO 8601 representation of micros-since-the-epoch timestamp to a byte buffer. The output length is always 26 bytes plus the length of the GMT offset suffix: YYYY-MM-DDTHH:MM:SS.MMMMMM<suffix>.- Parameters:
t
- the timestamp to be converted, micros since 1970-01-01T00:00:00 GMTgmtOffsetSuffix
- the time zone suffix, or null for no suffixb
- the byte buffer- Returns:
- the byte buffer
- Throws:
BufferOverflowException
- if there is not enough space in the buffer
-
appendISO8601Micros
public static ByteBuffer appendISO8601Micros(int year, int month, int day, int hour, int minute, int second, int millis, int micros, byte[] gmtOffsetSuffix, ByteBuffer b) Append an ISO 8601 representation of a broken-down time to a byte buffer. The output length is always 23 bytes plus the length of the GMT offset suffix: YYYY-MM-DDTHH:MM:SS.MMM<suffix>.- Parameters:
year
- the yearmonth
- the monthday
- the day of the monthhour
- the hourminute
- the minutesecond
- the secondmillis
- the millismicros
- the microsgmtOffsetSuffix
- the time zone suffix, or null for no suffixb
- the byte buffer- Returns:
- the byte buffer
- Throws:
BufferOverflowException
- if there is not enough space in the buffer
-