// read the tag and dispatch accordingly
int tag = i.readUnsignedByte();
switch( tag ){
case Const.CONSTANT_UTF8:
return UnicodeConstant.read( tag, i );
case Const.CONSTANT_INTEGER:
case Const.CONSTANT_FLOAT:
return SingleValueConstant.read( tag, i );
case Const.CONSTANT_DOUBLE:
case Const.CONSTANT_LONG:
return DoubleValueConstant.read( tag, i );
case Const.CONSTANT_STRING:
return StringConstant.read( tag, i );
case Const.CONSTANT_NAMEANDTYPE:
return NameAndTypeConstant.read( tag, i );
case Const.CONSTANT_CLASS:
return ClassConstant.read( tag, i );
case Const.CONSTANT_FIELD:
return FieldConstant.read( tag, i );
case Const.CONSTANT_METHOD:
return MethodConstant.read( tag, i );
case Const.CONSTANT_INTERFACEMETHOD:
return InterfaceConstant.read( tag, i );
default:
throw new DataFormatException("Format error (constant tag "+tag+" )");
}