/** Return all characters in given array as an array of bytes * in Utf8 representation. * @param src The array holding the characters. */ public static byte[] chars2utf(char[] src) { return chars2utf(src, 0, src.length); }
/** Return all characters in given array as an array of bytes * in Utf8 representation. * @param src The array holding the characters. */ public static byte[] chars2utf(char[] src) { return chars2utf(src, 0, src.length); }
/** Return all characters in given array as an array of bytes * in Utf8 representation. * @param src The array holding the characters. */ public static byte[] chars2utf(char[] src) { return chars2utf(src, 0, src.length); }
/** Return all characters in given array as an array of bytes * in Utf8 representation. * @param src The array holding the characters. */ public static byte[] chars2utf(char[] src) { return chars2utf(src, 0, src.length); }
/** Return string as an array of bytes in in Utf8 representation. */ public static byte[] string2utf(String s) { return chars2utf(s.toCharArray()); }
/** Return characters as an array of bytes in Utf8 representation. * @param src The array holding the characters. * @param sindex The start index from which characters are converted. * @param len The maximum number of characters to convert. */ public static byte[] chars2utf(char[] src, int sindex, int len) { byte[] dst = new byte[len * 3]; int len1 = chars2utf(src, sindex, dst, 0, len); byte[] result = new byte[len1]; System.arraycopy(dst, 0, result, 0, len1); return result; }
/** Return string as an array of bytes in in Utf8 representation. */ public static byte[] string2utf(String s) { return chars2utf(s.toCharArray()); }
/** Return characters as an array of bytes in Utf8 representation. * @param src The array holding the characters. * @param sindex The start index from which characters are converted. * @param len The maximum number of characters to convert. */ public static byte[] chars2utf(char[] src, int sindex, int len) { byte[] dst = new byte[len * 3]; int len1 = chars2utf(src, sindex, dst, 0, len); byte[] result = new byte[len1]; System.arraycopy(dst, 0, result, 0, len1); return result; }
/** Return string as an array of bytes in in Utf8 representation. */ public static byte[] string2utf(String s) { return chars2utf(s.toCharArray()); }
/** Return string as an array of bytes in in Utf8 representation. */ public static byte[] string2utf(String s) { return chars2utf(s.toCharArray()); }
/** Return characters as an array of bytes in Utf8 representation. * @param src The array holding the characters. * @param sindex The start index from which characters are converted. * @param len The maximum number of characters to convert. */ public static byte[] chars2utf(char[] src, int sindex, int len) { byte[] dst = new byte[len * 3]; int len1 = chars2utf(src, sindex, dst, 0, len); byte[] result = new byte[len1]; System.arraycopy(dst, 0, result, 0, len1); return result; }
/** Return characters as an array of bytes in Utf8 representation. * @param src The array holding the characters. * @param sindex The start index from which characters are converted. * @param len The maximum number of characters to convert. */ public static byte[] chars2utf(char[] src, int sindex, int len) { byte[] dst = new byte[len * 3]; int len1 = chars2utf(src, sindex, dst, 0, len); byte[] result = new byte[len1]; System.arraycopy(dst, 0, result, 0, len1); return result; }
@Override public Name fromChars(char[] cs, int start, int len) { byte[] name = new byte[len * 3]; int nbytes = Convert.chars2utf(cs, start, name, 0, len); return fromUtf(name, 0, nbytes); }
@Override public Name fromChars(char[] cs, int start, int len) { byte[] name = new byte[len * 3]; int nbytes = Convert.chars2utf(cs, start, name, 0, len); return fromUtf(name, 0, nbytes); }
Convert.chars2utf(cs, start, names, nc, len) - nc; int h = hashValue(names, nc, nbytes) & table.hashMask; Name n = table.hashes[h];
Convert.chars2utf(cs, start, names, nc, len) - nc; int h = hashValue(names, nc, nbytes) & table.hashMask; Name n = table.hashes[h];
@Override public Name fromChars(char[] cs, int start, int len) { int nc = this.nc; byte[] bytes = this.bytes = ArrayUtils.ensureCapacity(this.bytes, nc + len * 3); int nbytes = Convert.chars2utf(cs, start, bytes, nc, len) - nc; int h = hashValue(bytes, nc, nbytes) & hashMask; NameImpl n = hashes[h]; while (n != null && (n.getByteLength() != nbytes || !equals(bytes, n.index, bytes, nc, nbytes))) { n = n.next; } if (n == null) { n = new NameImpl(this); n.index = nc; n.length = nbytes; n.next = hashes[h]; hashes[h] = n; this.nc = nc + nbytes; if (nbytes == 0) { this.nc++; } } return n; }
@Override public Name fromChars(char[] cs, int start, int len) { int nc = this.nc; byte[] bytes = this.bytes = ArrayUtils.ensureCapacity(this.bytes, nc + len * 3); int nbytes = Convert.chars2utf(cs, start, bytes, nc, len) - nc; int h = hashValue(bytes, nc, nbytes) & hashMask; NameImpl n = hashes[h]; while (n != null && (n.getByteLength() != nbytes || !equals(bytes, n.index, bytes, nc, nbytes))) { n = n.next; } if (n == null) { n = new NameImpl(this); n.index = nc; n.length = nbytes; n.next = hashes[h]; hashes[h] = n; this.nc = nc + nbytes; if (nbytes == 0) { this.nc++; } } return n; }