Class Convert

java.lang.Object
io.deephaven.base.text.Convert

public class Convert extends Object
  • Field Details

    • MAX_SHORT_BYTES

      public static int MAX_SHORT_BYTES
      the maximum number of bytes in the ASCII decimal representation of an integer
    • MAX_INT_BYTES

      public static int MAX_INT_BYTES
      the maximum number of bytes in the ASCII decimal representation of an integer
    • MAX_LONG_BYTES

      public static int MAX_LONG_BYTES
      the maximum number of bytes in the ASCII decimal representation of a long
    • MAX_DOUBLE_BYTES

      public static int MAX_DOUBLE_BYTES
      the 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_BYTES
      the 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_BYTES
      the 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

      public static ByteBuffer appendShort(short n, ByteBuffer b)
      Append a decimal representation of a short to a byte buffer.
      Parameters:
      n - the integer to be converted
      b - the byte buffer
      Returns:
      the byte buffer
      Throws:
      BufferOverflowException - if there is not enough space in the buffer
    • appendInt

      public static ByteBuffer appendInt(int n, ByteBuffer b)
      Append a decimal representation of an integer to a byte buffer.
      Parameters:
      n - the integer to be converted
      b - the byte buffer
      Returns:
      the byte buffer
      Throws:
      BufferOverflowException - if there is not enough space in the buffer
    • appendLong

      public static ByteBuffer appendLong(long n, ByteBuffer b)
      Append a decimal representation of a long to a byte buffer.
      Parameters:
      n - the long to be converted
      b - the byte buffer
      Returns:
      the byte buffer
      Throws:
      BufferOverflowException - if there is not enough space in the buffer
    • appendDouble

      public static ByteBuffer appendDouble(double input, @NotNull @NotNull ByteBuffer dest)
      Append a decimal representation of a double to a ByteBuffer. Works as if Double.toString(double) were used.
      Parameters:
      input - The double to be converted
      dest - The ByteBuffer
      Returns:
      dest
    • appendISO8601Millis

      public static ByteBuffer appendISO8601Millis(long t, byte[] gmtOffsetSuffix, ByteBuffer b)
      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 GMT
      gmtOffsetSuffix - the time zone suffix, or null for no suffix
      b - 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 year
      month - the month
      day - the day of the month
      hour - the hour
      minute - the minute
      second - the second
      millis - the millis
      gmtOffsetSuffix - the time zone suffix, or null for no suffix
      b - the byte buffer
      Returns:
      the byte buffer
      Throws:
      BufferOverflowException - if there is not enough space in the buffer
    • appendISO8601Micros

      public static ByteBuffer appendISO8601Micros(long t, byte[] gmtOffsetSuffix, ByteBuffer b)
      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 GMT
      gmtOffsetSuffix - the time zone suffix, or null for no suffix
      b - 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 year
      month - the month
      day - the day of the month
      hour - the hour
      minute - the minute
      second - the second
      millis - the millis
      micros - the micros
      gmtOffsetSuffix - the time zone suffix, or null for no suffix
      b - the byte buffer
      Returns:
      the byte buffer
      Throws:
      BufferOverflowException - if there is not enough space in the buffer