@Test(expected = IllegalArgumentException.class) public void testStringNoNullChars() { PositionedByteRange buff = new SimplePositionedByteRange(3); OrderedBytes.encodeString(buff, "\u0000", Order.ASCENDING); }
public static int encodeString(PositionedByteRange dst, String val, Order ord) { if (null == val) { return encodeNull(dst, ord); } if (val.contains("\u0000")) throw new IllegalArgumentException("Cannot encode String values containing '\\u0000'"); final int offset = dst.getOffset(), start = dst.getPosition(); dst.put(TEXT); dst.put(val.getBytes(UTF8)); dst.put(TERM); ord.apply(dst.getBytes(), offset + start, dst.getPosition() - start); return dst.getPosition() - start; }
OrderedBytes { public static int encodeString(PositionedByteRange dst, String val, Order ord) { if (null == val) { return encodeNull(dst, ord); } if (val.contains("\u0000")) throw new IllegalArgumentException("Cannot encode String values containing '\\u0000'"); final int offset = dst.getOffset(), start = dst.getPosition(); dst.put(TEXT); dst.put(val.getBytes(UTF8)); dst.put(TERM); ord.apply(dst.getBytes(), offset + start, dst.getPosition() - start); return dst.getPosition() - start; } }
OrderedBytes { public static int encodeString(PositionedByteRange dst, String val, Order ord) { if (null == val) { return encodeNull(dst, ord); } if (val.contains("\u0000")) throw new IllegalArgumentException("Cannot encode String values containing '\\u0000'"); final int offset = dst.getOffset(), start = dst.getPosition(); dst.put(TEXT); dst.put(val.getBytes(UTF8)); dst.put(TERM); ord.apply(dst.getBytes(), offset + start, dst.getPosition() - start); return dst.getPosition() - start; }  }
OrderedBytes { public static int encodeString(PositionedByteRange dst, String val, Order ord) { if (null == val) { return encodeNull(dst, ord); } if (val.contains("\u0000")) throw new IllegalArgumentException("Cannot encode String values containing '\\u0000'"); final int offset = dst.getOffset(), start = dst.getPosition(); dst.put(TEXT); dst.put(val.getBytes(UTF8)); dst.put(TERM); ord.apply(dst.getBytes(), offset + start, dst.getPosition() - start); return dst.getPosition() - start; }  static int encodeNumeric(PositionedByteRange dst, long val, Order ord); static int encodeNumeric(PositionedByteRange dst, double val, Order ord); static int encodeNumeric(PositionedByteRange dst, BigDecimal val, Order ord); static double decodeNumericAsDouble(PositionedByteRange src); static long decodeNumericAsLong(PositionedByteRange src); static BigDecimal decodeNumericAsBigDecimal(PositionedByteRange src); static int encodeString(PositionedByteRange dst, String val, Order ord); static String decodeString(PositionedByteRange src); static int blobVarEncodedLength(int len); static int encodeBlobVar(PositionedByteRange dst, byte[] val, int voff, int vlen,
      Order ord); static int encodeBlobVar(PositionedByteRange dst, byte[] val, Order ord); static byte[] decodeBlobVar(PositionedByteRange src); static int encodeBlobCopy(PositionedByteRange dst, byte[] val, int voff, int vlen,
      Order ord); static int encodeBlobCopy(PositionedByteRange dst, byte[] val, Order ord); static byte[] decodeBlobCopy(PositionedByteRange src); static int encodeNull(PositionedByteRange dst, Order ord); static int encodeInt8(PositionedByteRange dst, byte val, Order ord); static byte decodeInt8(PositionedByteRange src); static int encodeInt16(PositionedByteRange dst, short val, Order ord); static short decodeInt16(PositionedByteRange src); static int encodeInt32(PositionedByteRange dst, int val, Order ord); static int decodeInt32(PositionedByteRange src); static int encodeInt64(PositionedByteRange dst, long val, Order ord); static long decodeInt64(PositionedByteRange src); static int encodeFloat32(PositionedByteRange dst, float val, Order ord); static float decodeFloat32(PositionedByteRange src); static int encodeFloat64(PositionedByteRange dst, double val, Order ord); static double decodeFloat64(PositionedByteRange src); static boolean isEncodedValue(PositionedByteRange src); static boolean isNull(PositionedByteRange src); static boolean isNumeric(PositionedByteRange src); static boolean isNumericInfinite(PositionedByteRange src); static boolean isNumericNaN(PositionedByteRange src); static boolean isNumericZero(PositionedByteRange src); static boolean isFixedInt32(PositionedByteRange src); static boolean isFixedInt64(PositionedByteRange src); static boolean isFixedFloat32(PositionedByteRange src); static boolean isFixedFloat64(PositionedByteRange src); static boolean isText(PositionedByteRange src); static boolean isBlobVar(PositionedByteRange src); static boolean isBlobCopy(PositionedByteRange src); static int skip(PositionedByteRange src); static int length(PositionedByteRange buff); }
OrderedBytes { public static int encodeString(PositionedByteRange dst, String val, Order ord) { if (null == val) { return encodeNull(dst, ord); } if (val.contains("\u0000")) throw new IllegalArgumentException("Cannot encode String values containing '\\u0000'"); final int offset = dst.getOffset(), start = dst.getPosition(); dst.put(TEXT); dst.put(val.getBytes(UTF8)); dst.put(TERM); ord.apply(dst.getBytes(), offset + start, dst.getPosition() - start); return dst.getPosition() - start; }  static int encodeNumeric(PositionedByteRange dst, long val, Order ord); static int encodeNumeric(PositionedByteRange dst, double val, Order ord); static int encodeNumeric(PositionedByteRange dst, BigDecimal val, Order ord); static double decodeNumericAsDouble(PositionedByteRange src); static long decodeNumericAsLong(PositionedByteRange src); static BigDecimal decodeNumericAsBigDecimal(PositionedByteRange src); static int encodeString(PositionedByteRange dst, String val, Order ord); static String decodeString(PositionedByteRange src); static int blobVarEncodedLength(int len); static int encodeBlobVar(PositionedByteRange dst, byte[] val, int voff, int vlen,
      Order ord); static int encodeBlobVar(PositionedByteRange dst, byte[] val, Order ord); static byte[] decodeBlobVar(PositionedByteRange src); static int encodeBlobCopy(PositionedByteRange dst, byte[] val, int voff, int vlen,
      Order ord); static int encodeBlobCopy(PositionedByteRange dst, byte[] val, Order ord); static byte[] decodeBlobCopy(PositionedByteRange src); static int encodeNull(PositionedByteRange dst, Order ord); static int encodeInt8(PositionedByteRange dst, byte val, Order ord); static byte decodeInt8(PositionedByteRange src); static int encodeInt16(PositionedByteRange dst, short val, Order ord); static short decodeInt16(PositionedByteRange src); static int encodeInt32(PositionedByteRange dst, int val, Order ord); static int decodeInt32(PositionedByteRange src); static int encodeInt64(PositionedByteRange dst, long val, Order ord); static long decodeInt64(PositionedByteRange src); static int encodeFloat32(PositionedByteRange dst, float val, Order ord); static float decodeFloat32(PositionedByteRange src); static int encodeFloat64(PositionedByteRange dst, double val, Order ord); static double decodeFloat64(PositionedByteRange src); static boolean isEncodedValue(PositionedByteRange src); static boolean isNull(PositionedByteRange src); static boolean isNumeric(PositionedByteRange src); static boolean isNumericInfinite(PositionedByteRange src); static boolean isNumericNaN(PositionedByteRange src); static boolean isNumericZero(PositionedByteRange src); static boolean isFixedInt32(PositionedByteRange src); static boolean isFixedInt64(PositionedByteRange src); static boolean isFixedFloat32(PositionedByteRange src); static boolean isFixedFloat64(PositionedByteRange src); static boolean isText(PositionedByteRange src); static boolean isBlobVar(PositionedByteRange src); static boolean isBlobCopy(PositionedByteRange src); static int skip(PositionedByteRange src); static int length(PositionedByteRange buff); static final Charset UTF8; static final int MAX_PRECISION; static final MathContext DEFAULT_MATH_CONTEXT; }