/** Copy all bytes of this name to buffer cs, starting at start. */ public void getBytes(byte cs[], int start) { System.arraycopy(getByteArray(), getByteOffset(), cs, start, getByteLength()); }
/** Copy all bytes of this name to buffer cs, starting at start. */ public void getBytes(byte cs[], int start) { System.arraycopy(getByteArray(), getByteOffset(), cs, start, getByteLength()); }
/** Returns last occurrence of byte b in this name, -1 if not found. */ public int lastIndexOf(byte b) { byte[] bytes = getByteArray(); int offset = getByteOffset(); int i = getByteLength() - 1; while (i >= 0 && bytes[offset + i] != b) i--; return i; }
/** Returns the sub-name starting at position start, up to and * excluding position end. */ public Name subName(int start, int end) { if (end < start) end = start; return table.fromUtf(getByteArray(), getByteOffset() + start, end - start); }
/** Returns last occurrence of byte b in this name, -1 if not found. */ public int lastIndexOf(byte b) { byte[] bytes = getByteArray(); int offset = getByteOffset(); int i = getByteLength() - 1; while (i >= 0 && bytes[offset + i] != b) i--; return i; }
/** Returns the sub-name starting at position start, up to and * excluding position end. */ public Name subName(int start, int end) { if (end < start) end = start; return table.fromUtf(getByteArray(), getByteOffset() + start, end - start); }
/** Does this name start with prefix? */ public boolean startsWith(Name prefix) { byte[] thisBytes = this.getByteArray(); int thisOffset = this.getByteOffset(); int thisLength = this.getByteLength(); byte[] prefixBytes = prefix.getByteArray(); int prefixOffset = prefix.getByteOffset(); int prefixLength = prefix.getByteLength(); int i = 0; while (i < prefixLength && i < thisLength && thisBytes[thisOffset + i] == prefixBytes[prefixOffset + i]) i++; return i == prefixLength; }
/** Does this name start with prefix? */ public boolean startsWith(Name prefix) { byte[] thisBytes = this.getByteArray(); int thisOffset = this.getByteOffset(); int thisLength = this.getByteLength(); byte[] prefixBytes = prefix.getByteArray(); int prefixOffset = prefix.getByteOffset(); int prefixLength = prefix.getByteLength(); int i = 0; while (i < prefixLength && i < thisLength && thisBytes[thisOffset + i] == prefixBytes[prefixOffset + i]) i++; return i == prefixLength; }
public static void encodeClassName (TypeElement te, final StringBuilder sb, final char separator) { Name name = ((Symbol.ClassSymbol)te).flatname; assert name != null; final int nameLength = name.getByteLength(); final char[] nameChars = new char[nameLength]; int charLength = Convert.utf2chars(name.getByteArray(), name.getByteOffset(), nameChars, 0, nameLength); if (separator != '.') { //NOI18N for (int i=0; i<charLength; i++) { if (nameChars[i] == '.') { //NOI18N nameChars[i] = separator; } } } sb.append(nameChars,0,charLength); }
/** Append a name. */ public void appendName(Name name) { appendBytes(name.getByteArray(), name.getByteOffset(), name.getByteLength()); }
/** Return external representation of given name, * converting '/' to '.'. */ public static byte[] externalize(Name name) { return externalize(name.getByteArray(), name.getByteOffset(), name.getByteLength()); }
/** Append a name. */ public void appendName(Name name) { appendBytes(name.getByteArray(), name.getByteOffset(), name.getByteLength()); }
/** Return the string representation of this name. */ @Override public String toString() { return Convert.utf2string(getByteArray(), getByteOffset(), getByteLength()); }
/** Return external representation of given name, * converting '/' to '.'. */ public static byte[] externalize(Name name) { return externalize(name.getByteArray(), name.getByteOffset(), name.getByteLength()); }
public final void print(Name n) { if (n == null) return; out.appendUtf8(n.getByteArray(), n.getByteOffset(), n.getByteLength()); }
/** Return internal representation of given name, * converting '/' to '.'. */ public static byte[] internalize(Name name) { return internalize(name.getByteArray(), name.getByteOffset(), name.getByteLength()); }
/** Return the string representation of this name. */ @Override public String toString() { return Convert.utf2string(getByteArray(), getByteOffset(), getByteLength()); }
/** Return internal representation of given name, * converting '/' to '.'. */ public static byte[] internalize(Name name) { return internalize(name.getByteArray(), name.getByteOffset(), name.getByteLength()); }