public static int fieldDescToBinaryJLS()

in core/org.openjdk.jmc.common/src/main/java/org/openjdk/jmc/common/util/MethodToolkit.java [297:352]


	public static int fieldDescToBinaryJLS(CharSequence desc, int start, Appendable out)
			throws IllegalArgumentException, IOException {
		int top = desc.length();
		if (start >= top) {
			throw new IllegalArgumentException("start=" + start + " > in.length()=" + top); //$NON-NLS-1$ //$NON-NLS-2$
		}

		int pos = start;
		char c = desc.charAt(pos++);
		switch (c) {
		case '[':
			pos = fieldDescToBinaryJLS(desc, pos, out);
			out.append("[]"); //$NON-NLS-1$
			break;
		case 'B':
			out.append(TYPE_BYTE);
			break;
		case 'C':
			out.append(TYPE_CHAR);
			break;
		case 'D':
			out.append(TYPE_DOUBLE);
			break;
		case 'F':
			out.append(TYPE_FLOAT);
			break;
		case 'I':
			out.append(TYPE_INTEGER);
			break;
		case 'J':
			out.append(TYPE_LONG);
			break;
		case 'S':
			out.append(TYPE_SHORT);
			break;
		case 'Z':
			out.append(TYPE_BOOLEAN);
			break;
		case 'V':
			out.append(TYPE_VOID);
			break;
		case 'L':
			while (pos < top) {
				c = desc.charAt(pos++);
				if (c == ';') {
					return pos;
				}
				out.append((c == '/') ? '.' : c);
			}
			throw new IllegalArgumentException("Class name '" + desc.subSequence(start + 1, pos) //$NON-NLS-1$
					+ "' in field descriptor not terminated with ';'."); //$NON-NLS-1$
		default:
			throw new IllegalArgumentException("The char '" + c + "' is not a valid first char of a field descriptor."); //$NON-NLS-1$ //$NON-NLS-2$
		}
		return pos;
	}