Examples of fromByteBuffer()


Examples of com.netflix.astyanax.serializers.AbstractSerializer.fromByteBuffer()

    @Test(expected = SerializationException.class)
    public void testCannotRoundtripBytes() throws Throwable {
        try {
            byte[] expected = new byte[] {1,2,3,4,5};
            AbstractSerializer ser = NumericSerializer.serializerFor(SimpleNumber.class);
            byte[] actual = (byte[])ser.fromByteBuffer(ser.toByteBuffer(expected));
            Assert.assertArrayEquals(expected, actual);
        } catch (RuntimeException ex) {
            throw ex.getCause();
        }
    }
View Full Code Here

Examples of com.rackspacecloud.blueflood.io.serializers.SlotStateSerializer.fromByteBuffer()

    }

    private SlotState fromString(String string) {
        SlotStateSerializer slotSer = SlotStateSerializer.get();
        StringSerializer stringSer = StringSerializer.get();
        return slotSer.fromByteBuffer(stringSer.toByteBuffer(string));
    }
}
View Full Code Here

Examples of me.prettyprint.cassandra.serializers.LongSerializer.fromByteBuffer()

        {
            return null;
        }

        HColumn<String, String> hColumn = columnSlice.getColumnByName( columnName );
        return hColumn == null ? null : ls.fromByteBuffer( hColumn.getValueBytes() );
    }

    public static void addInsertion( Mutator<String> mutator, String key, String columnFamily, String columnName,
                                     String value )
    {
View Full Code Here

Examples of me.prettyprint.cassandra.serializers.LongSerializer.fromByteBuffer()

    test(null);
  }

  private void test(Long number) {
    LongSerializer ext = new LongSerializer();
    assertEquals(number, ext.fromByteBuffer(ext.toByteBuffer(number)));
  }
}
View Full Code Here

Examples of me.prettyprint.cassandra.serializers.StringSerializer.fromByteBuffer()

        {
            return null;
        }

        HColumn<String, Long> hColumn = columnSlice.getColumnByName( columnName );
        return hColumn == null ? null : ss.fromByteBuffer( hColumn.getValueBytes() );
    }

    public static Long getAsLongValue( ColumnSlice<String, String> columnSlice, String columnName )
    {
        LongSerializer ls = LongSerializer.get();
View Full Code Here

Examples of me.prettyprint.hector.api.Serializer.fromByteBuffer()

        Serializer serializer = ExtensibleTypeInferringSerializer.getSerializer(BigDecimal.class);

        ByteBuffer buffer = serializer.toByteBuffer(value);

        BigDecimal deserializedBigDecimal = (BigDecimal) serializer.fromByteBuffer(buffer);

        assertEquals(value, deserializedBigDecimal);
    }
}
View Full Code Here

Examples of me.prettyprint.hector.api.Serializer.fromByteBuffer()

        Serializer serializer = ExtensibleTypeInferringSerializer.getSerializer(DateTime.class);

        ByteBuffer buffer = serializer.toByteBuffer(value);

        DateTime deserializedDateTime = (DateTime) serializer.fromByteBuffer(buffer);

        assertEquals(value, deserializedDateTime);
    }
}
View Full Code Here

Examples of me.prettyprint.hector.api.Serializer.fromByteBuffer()

        Serializer serializer = ExtensibleTypeInferringSerializer.getSerializer(Reading.class);

        ByteBuffer buffer = serializer.toByteBuffer(reading);

        Reading deserializedReading = new Reading(uuid, date, (Reading) serializer.fromByteBuffer(buffer));

        assertEquals(reading, deserializedReading);
    }
}
View Full Code Here

Examples of me.prettyprint.hector.api.Serializer.fromByteBuffer()

  @SuppressWarnings("rawtypes")
  private void test(Object object) {
    TypeInferringSerializer ext = TypeInferringSerializer.get();
    ByteBuffer bytes = ext.toByteBuffer(object);
    Serializer ser = SerializerTypeInferer.getSerializer(object.getClass());
    Object target = ser.fromByteBuffer(bytes);
    assertEquals(object, target);
  }

  private static class SampleObject implements Serializable {
    private final String a = "test";
View Full Code Here

Examples of me.prettyprint.hector.api.Serializer.fromByteBuffer()

    Object value = null;
    Serializer serializer = GoraSerializerTypeInferer.getSerializer(schema);
    if (serializer == null) {
      LOG.info("Schema is not supported: " + schema.toString());
    } else {
      value = serializer.fromByteBuffer(byteBuffer);
    }
    return value;
  }

}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.