public static void writeDouble(RandomAccessOutput byteStream, double d) {
   long v = Double.doubleToLongBits(d);
   byteStream.write((byte) (v >> 56));
   byteStream.write((byte) (v >> 48));
   byteStream.write((byte) (v >> 40));
   byteStream.write((byte) (v >> 32));
   byteStream.write((byte) (v >> 24));
   byteStream.write((byte) (v >> 16));
   byteStream.write((byte) (v >> 8));
   byteStream.write((byte) (v));
 }
Exemplo n.º 2
0
 @Override
 public void writeValue(RandomAccessOutput dest) throws SerDeException {
   if (!(value instanceof BinaryComparable)) {
     throw new SerDeException("Unexpected type " + value.getClass().getCanonicalName());
   }
   BinaryComparable b = (BinaryComparable) value;
   dest.write(b.getBytes(), 0, b.getLength());
 }
Exemplo n.º 3
0
 @Override
 public void writeKey(RandomAccessOutput dest) throws SerDeException {
   if (!(key instanceof BinaryComparable)) {
     throw new SerDeException("Unexpected type " + key.getClass().getCanonicalName());
   }
   sanityCheckKeyForTag();
   BinaryComparable b = (BinaryComparable) key;
   dest.write(b.getBytes(), 0, b.getLength() - (hasTag ? 1 : 0));
 }
Exemplo n.º 4
0
 @Override
 public void writeValue(RandomAccessOutput dest) throws SerDeException {
   byte[] valueBytes = val.getBytes();
   int valueLength = val.getLength();
   dest.write(valueBytes, 0, valueLength);
 }
Exemplo n.º 5
0
 @Override
 public void writeKey(RandomAccessOutput dest) throws SerDeException {
   byte[] keyBytes = key.getBytes();
   int keyLength = key.getLength();
   dest.write(keyBytes, 0, keyLength);
 }
 public static void writeVLong(RandomAccessOutput byteStream, long l) {
   byte[] vLongBytes = vLongBytesThreadLocal.get();
   int len = LazyBinaryUtils.writeVLongToByteArray(vLongBytes, l);
   byteStream.write(vLongBytes, 0, len);
 }