int code = 0; for (int i = start; i < start + length; ++i) { if (isTypeCodeChar(b, i)) { code <<= ElementBits; switch (b.b[i]) {
int code = 0; for (int i = start; i < start + length; ++i) { if (isTypeCodeChar(b, i)) { code <<= ElementBits; switch (b.b[i]) {
/** * @return true iff the class returned by parseForClass is primitive * @throws IllegalArgumentException if name is null */ public static boolean classIsPrimitive(ImmutableByteArray name, int start, int length) throws IllegalArgumentException { if (name == null) { throw new IllegalArgumentException("name is null"); } try { while (length > 0 && isTypeCodeChar(name, start)) { start++; length--; } if (start >= name.b.length) { throw new IllegalArgumentException("ill-formed type name: " + name); } return name.b[start] != 'L'; } catch (ArrayIndexOutOfBoundsException e) { throw new IllegalArgumentException(name.toString(), e); } }
/** * @return true iff the class returned by parseForClass is primitive * @throws IllegalArgumentException if name is null */ public static boolean classIsPrimitive(ImmutableByteArray name, int start, int length) throws IllegalArgumentException { if (name == null) { throw new IllegalArgumentException("name is null"); } try { while (length > 0 && isTypeCodeChar(name, start)) { start++; length--; } if (start >= name.b.length) { throw new IllegalArgumentException("ill-formed type name: " + name); } return name.b[start] != 'L'; } catch (ArrayIndexOutOfBoundsException e) { throw new IllegalArgumentException(name.toString(), e); } }
/** * Parse an array descriptor to obtain number of dimensions in corresponding array type. b: descriptor - something like * "[Ljava/lang/String;" or "[[I" * * @return dimensionality - something like "Ljava/lang/String;" or "I" * @throws IllegalArgumentException if b is null */ public static ImmutableByteArray parseForInnermostArrayElementDescriptor(ImmutableByteArray b, int start, int length) { if (b == null) { throw new IllegalArgumentException("b is null"); } try { int i = start; for (; i < start + length; ++i) { if (! isTypeCodeChar(b, i)) { break; } } return new ImmutableByteArray(b.b, i, length - (i - start)); } catch (ArrayIndexOutOfBoundsException e) { throw new IllegalArgumentException("invalid element desciptor: " + b, e); } }
/** * Parse an array descriptor to obtain number of dimensions in corresponding array type. b: descriptor - something like * "[Ljava/lang/String;" or "[[I" * * @return dimensionality - something like "Ljava/lang/String;" or "I" * @throws IllegalArgumentException if b is null */ public static ImmutableByteArray parseForInnermostArrayElementDescriptor(ImmutableByteArray b, int start, int length) { if (b == null) { throw new IllegalArgumentException("b is null"); } try { int i = start; for (; i < start + length; ++i) { if (! isTypeCodeChar(b, i)) { break; } } return new ImmutableByteArray(b.b, i, length - (i - start)); } catch (ArrayIndexOutOfBoundsException e) { throw new IllegalArgumentException("invalid element desciptor: " + b, e); } }
/** * Given that name[start:start+length] is a Type name in JVM format, parse it for the package * * @return an ImmutableByteArray that represents the package, or null if it's the unnamed package * @throws IllegalArgumentException if name == null */ public static ImmutableByteArray parseForPackage(ImmutableByteArray name, int start, int length) throws IllegalArgumentException { try { if (name == null) { throw new IllegalArgumentException("name == null"); } int lastSlash = -1; for (int i = start; i < start + length; i++) { if (name.b[i] == '/') { lastSlash = i; } } if (lastSlash == -1) { return null; } short dim = 0; while (isTypeCodeChar(name, start+dim)) { dim++; } return new ImmutableByteArray(name.b, start + 1 + dim, lastSlash - start - 1 - dim); } catch (ArrayIndexOutOfBoundsException e) { throw new IllegalArgumentException("invalid name " + name + " start: " + start + " length: " + length, e); } }
/** * Given that name[start:start+length] is a Type name in JVM format, parse it for the package * * @return an ImmutableByteArray that represents the package, or null if it's the unnamed package * @throws IllegalArgumentException if name == null */ public static ImmutableByteArray parseForPackage(ImmutableByteArray name, int start, int length) throws IllegalArgumentException { try { if (name == null) { throw new IllegalArgumentException("name == null"); } int lastSlash = -1; for (int i = start; i < start + length; i++) { if (name.b[i] == '/') { lastSlash = i; } } if (lastSlash == -1) { return null; } short dim = 0; while (isTypeCodeChar(name, start+dim)) { dim++; } return new ImmutableByteArray(name.b, start + 1 + dim, lastSlash - start - 1 - dim); } catch (ArrayIndexOutOfBoundsException e) { throw new IllegalArgumentException("invalid name " + name + " start: " + start + " length: " + length, e); } }
while (isTypeCodeChar(name, start)) { start++; length--;
while (isTypeCodeChar(name, start)) { start++; length--;
case TypeReference.ReferenceTypeCode: { int off = i - 1; while (StringStuff.isTypeCodeChar(b, i)) { ++i;
case TypeReference.ReferenceTypeCode: { int off = i - 1; while (StringStuff.isTypeCodeChar(b, i)) { ++i;