Exemplo n.º 1
0
 /**
  * Extracts the value of a cell containing a data point.
  *
  * @param values The contents of a cell in HBase.
  * @param value_idx The offset inside {@code values} at which the value starts.
  * @param flags The flags for this value.
  * @return The value of the cell.
  */
 static double extractFloatingPointValue(
     final byte[] values, final int value_idx, final byte flags) {
   switch (flags & Const.LENGTH_MASK) {
     case 7:
       return Double.longBitsToDouble(Bytes.getLong(values, value_idx));
     case 3:
       return Float.intBitsToFloat(Bytes.getInt(values, value_idx));
   }
   throw new IllegalDataException(
       "Floating point value @ "
           + value_idx
           + " not on 8 or 4 bytes in "
           + Arrays.toString(values));
 }
Exemplo n.º 2
0
 /**
  * Extracts the value of a cell containing a data point.
  *
  * @param values The contents of a cell in HBase.
  * @param value_idx The offset inside {@code values} at which the value starts.
  * @param flags The flags for this value.
  * @return The value of the cell.
  */
 static long extractIntegerValue(final byte[] values, final int value_idx, final byte flags) {
   switch (flags & Const.LENGTH_MASK) {
     case 7:
       return Bytes.getLong(values, value_idx);
     case 3:
       return Bytes.getInt(values, value_idx);
     case 1:
       return Bytes.getShort(values, value_idx);
     case 0:
       return values[value_idx] & 0xFF;
   }
   throw new IllegalDataException(
       "Integer value @ " + value_idx + " not on 8/4/2/1 bytes in " + Arrays.toString(values));
 }