/** * Compose. * * @param value * the value * @param clazz * the clazz * @return the byte[] */ private static byte[] compose(Object value, Class clazz) { return IntegerType.instance.decompose((BigInteger) value).array(); }
/** * Decompose. * * @param value * the value * @param clazz * the clazz * @return the object */ private static Object decompose(Object value, Class clazz) { ByteBuffer buf = ByteBuffer.wrap((byte[]) value, 0, ((byte[]) value).length); return IntegerType.instance.compose(buf); } }
@Override public String toJSONString(ByteBuffer buffer, ProtocolVersion protocolVersion) { return getSerializer().deserialize(buffer).toString(); }
return 1; int lhsMsbIdx = findMostSignificantByte(lhs); int rhsMsbIdx = findMostSignificantByte(rhs);
public int compareCustom(ByteBuffer lhs, ByteBuffer rhs) { return IntegerType.compareIntegers(lhs, rhs); }
@Override public String toJSONString(ByteBuffer buffer, ProtocolVersion protocolVersion) { return getSerializer().deserialize(buffer).toString(); }
return 1; int lhsMsbIdx = findMostSignificantByte(lhs); int rhsMsbIdx = findMostSignificantByte(rhs);
public int compareCustom(ByteBuffer lhs, ByteBuffer rhs) { return IntegerType.compareIntegers(lhs, rhs); }
private static byte[] compose(Object value, Class clazz) { return IntegerType.instance.decompose((BigInteger) value).array(); }
@Override public String toJSONString(ByteBuffer buffer, ProtocolVersion protocolVersion) { return getSerializer().deserialize(buffer).toString(); }
return 1; int lhsMsbIdx = findMostSignificantByte(lhs); int rhsMsbIdx = findMostSignificantByte(rhs);
public int compareCustom(ByteBuffer lhs, ByteBuffer rhs) { return IntegerType.compareIntegers(lhs, rhs); }
private static Object decompose(Object value, Class clazz) { ByteBuffer buf = ByteBuffer.wrap((byte[]) value, 0, ((byte[]) value).length); return IntegerType.instance.compose(buf); } }
public ByteBuffer fromString(String source) throws MarshalException { // Return an empty ByteBuffer for an empty string. if (source.isEmpty()) return ByteBufferUtil.EMPTY_BYTE_BUFFER; BigInteger integerType; try { integerType = new BigInteger(source); } catch (Exception e) { throw new MarshalException(String.format("unable to make int from '%s'", source), e); } return decompose(integerType); }
@Override public String toJSONString(ByteBuffer buffer, ProtocolVersion protocolVersion) { return getSerializer().deserialize(buffer).toString(); }
return 1; int lhsMsbIdx = findMostSignificantByte(lhs); int rhsMsbIdx = findMostSignificantByte(rhs);
public int compareCustom(ByteBuffer lhs, ByteBuffer rhs) { return IntegerType.compareIntegers(lhs, rhs); }
public ByteBuffer fromString(String source) throws MarshalException { // Return an empty ByteBuffer for an empty string. if (source.isEmpty()) return ByteBufferUtil.EMPTY_BYTE_BUFFER; BigInteger integerType; try { integerType = new BigInteger(source); } catch (Exception e) { throw new MarshalException(String.format("unable to make int from '%s'", source), e); } return decompose(integerType); }
@Override public Term fromJSONObject(Object parsed) throws MarshalException { try { return new Constants.Value(getSerializer().serialize(new BigInteger(parsed.toString()))); } catch (NumberFormatException exc) { throw new MarshalException(String.format( "Value '%s' is not a valid representation of a varint value", parsed)); } }
return 1; int lhsMsbIdx = findMostSignificantByte(lhs); int rhsMsbIdx = findMostSignificantByte(rhs);