@Override public int getSizeInBytes(byte[] buf, int offset) throws IOException { return getBytesLength(buf, offset, buf.length - offset); }
/** * Compares between the two objects in serialized form. * @param b1 the first byte array to be compared * @param s1 the beginning index in {@code b1} * @param l1 the limit byte size in {@code b1} * @param b2 the second byte array to be compared * @param s2 the beginning index in {@code b2} * @param l2 the limit byte size in {@code b2} * @return the comparison result */ public static int compareBytes( byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { int len1 = getBytesLength(b1, s1, l1); int len2 = getBytesLength(b2, s2, l2); return ByteArrayUtil.compare(b1, s1, len1, b2, s2, len2); } }