Browse files

updated to cass 0.7.5

  • Loading branch information...
1 parent 24b5ada commit 97dd32ca2a8a274c8dfdc40f698534b9629d0354 @ceocoder committed May 6, 2011
Showing with 14 additions and 2 deletions.
  1. +1 −1 ivy.xml
  2. +13 −1 src/lucandra/VIntType.java
View
2 ivy.xml
@@ -36,7 +36,7 @@
<dependency org="org.mortbay.jetty" name="jetty-util" rev="6.1.26" conf="* -> *,!sources,!javadoc" />
<dependency org="org.mortbay.jetty" name="jsp-2.1" rev="6.1.14" conf="* -> *,!sources,!javadoc" />
- <dependency org="org.apache.cassandra" name="cassandra-all" rev="0.7.4" conf="* -> *,!sources,!javadoc" />
+ <dependency org="org.apache.cassandra" name="cassandra-all" rev="0.7.5" conf="* -> *,!sources,!javadoc" />
<dependency org="net.java.dev.jna" name="jna" rev="3.2.7" conf="* -> *,!sources,!javadoc" />
</dependencies>
</ivy-module>
View
14 src/lucandra/VIntType.java
@@ -19,12 +19,14 @@
*/
package lucandra;
+import java.math.BigInteger;
import java.nio.ByteBuffer;
import org.apache.cassandra.db.marshal.AbstractType;
import org.apache.cassandra.db.marshal.MarshalException;
+import org.apache.cassandra.utils.ByteBufferUtil;
-public class VIntType extends AbstractType {
+public class VIntType extends AbstractType<BigInteger> {
public static final VIntType instance = new VIntType();
@@ -62,6 +64,16 @@ public int compare(ByteBuffer o1, ByteBuffer o2) {
return i1 < i2 ? -1 : 1;
}
+ public BigInteger compose(ByteBuffer bytes)
+ {
+ return new BigInteger(ByteBufferUtil.getArray(bytes));
+ }
+
+ public ByteBuffer decompose(BigInteger value)
+ {
+ return ByteBuffer.wrap(value.toByteArray());
+ }
+
public void validate(ByteBuffer bytes) throws MarshalException
{

0 comments on commit 97dd32c

Please sign in to comment.