private static ArrayValue readLocalDateTimeArray( ByteBuffer bb, int offset ) { final int len = bb.getInt( offset ); offset += Integer.BYTES; final LocalDateTime[] array = new LocalDateTime[len]; for ( int i = 0; i < len; i++ ) { final long epochSecond = bb.getLong( offset ); offset += Long.BYTES; final int nanos = bb.getInt( offset ); offset += Integer.BYTES; array[i] = LocalDateTime.ofEpochSecond( epochSecond, nanos, UTC ); } return localDateTimeArray( array ); }
/** * @see RandomValues */ public LocalDateTimeArray nextLocalDateTimeArray() { return Values.localDateTimeArray( nextLocalDateTimeArrayRaw( minArray(), maxArray() ) ); }
@Override public ArrayValue decodeArray( Value dataValue ) { if ( dataValue instanceof LongArray ) { LongArray numbers = (LongArray) dataValue; LocalDateTime[] dateTimes = new LocalDateTime[numbers.length() / BLOCKS_LOCAL_DATETIME]; for ( int i = 0; i < dateTimes.length; i++ ) { long epochSecond = numbers.longValue( i * BLOCKS_LOCAL_DATETIME ); long nanoOfSecond = numbers.longValue( i * BLOCKS_LOCAL_DATETIME + 1 ); checkValidNanoOfSecond( nanoOfSecond ); dateTimes[i] = LocalDateTime.ofInstant( Instant.ofEpochSecond( epochSecond, nanoOfSecond ), UTC ); } return Values.localDateTimeArray( dateTimes ); } else { throw new InvalidRecordException( "Array with unexpected type. Actual:" + dataValue.getClass().getSimpleName() + ". Expected: LongArray." ); } } },
return localDateTimeArray( copy( value, new LocalDateTime[value.length] ) );
assertLowest( localDateTimeArray( new LocalDateTime[0] ) );
private static ArrayValue readLocalDateTimeArray( ByteBuffer bb, int offset ) { final int len = bb.getInt( offset ); offset += Integer.BYTES; final LocalDateTime[] array = new LocalDateTime[len]; for ( int i = 0; i < len; i++ ) { final long epochSecond = bb.getLong( offset ); offset += Long.BYTES; final int nanos = bb.getInt( offset ); offset += Integer.BYTES; array[i] = LocalDateTime.ofEpochSecond( epochSecond, nanos, UTC ); } return localDateTimeArray( array ); }
@Override public ArrayValue decodeArray( Value dataValue ) { if ( dataValue instanceof LongArray ) { LongArray numbers = (LongArray) dataValue; LocalDateTime[] dateTimes = new LocalDateTime[numbers.length() / BLOCKS_LOCAL_DATETIME]; for ( int i = 0; i < dateTimes.length; i++ ) { long epochSecond = numbers.longValue( i * BLOCKS_LOCAL_DATETIME ); long nanoOfSecond = numbers.longValue( i * BLOCKS_LOCAL_DATETIME + 1 ); checkValidNanoOfSecond( nanoOfSecond ); dateTimes[i] = LocalDateTime.ofInstant( Instant.ofEpochSecond( epochSecond, nanoOfSecond ), UTC ); } return Values.localDateTimeArray( dateTimes ); } else { throw new InvalidRecordException( "Array with unexpected type. Actual:" + dataValue.getClass().getSimpleName() + ". Expected: LongArray." ); } } },
/** * @see RandomValues */ public LocalDateTimeArray nextLocalDateTimeArray() { return Values.localDateTimeArray( nextLocalDateTimeArrayRaw( minArray(), maxArray() ) ); }
return localDateTimeArray( copy( value, new LocalDateTime[value.length] ) );