本文整理匯總了Java中com.intellij.util.cls.ClsUtil.CONSTANT_Long方法的典型用法代碼示例。如果您正苦於以下問題:Java ClsUtil.CONSTANT_Long方法的具體用法?Java ClsUtil.CONSTANT_Long怎麽用?Java ClsUtil.CONSTANT_Long使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.util.cls.ClsUtil
的用法示例。
在下文中一共展示了ClsUtil.CONSTANT_Long方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initConstantPool
import com.intellij.util.cls.ClsUtil; //導入方法依賴的package包/類
private void initConstantPool() throws ClsFormatException {
if (myConstantPoolOffsets == null){
BytePointer ptr = new BytePointer(getData(), 0);
ConstantPoolIterator iterator = new ConstantPoolIterator(ptr);
myConstantPoolOffsets = new int[iterator.getEntryCount()];
myConstantPoolOffsets[0] = iterator.getCurrentOffset();
int index = 1;
while (iterator.hasMoreEntries()) {
int tag = ClsUtil.readU1(ptr);
if (tag == ClsUtil.CONSTANT_Long || tag == ClsUtil.CONSTANT_Double) {
myConstantPoolOffsets[index++] = ptr.offset + 8; // takes 2 entries!
}
iterator.next();
myConstantPoolOffsets[index++] = iterator.getCurrentOffset();
}
}
}
示例2: readConstant
import com.intellij.util.cls.ClsUtil; //導入方法依賴的package包/類
private ConstantValue readConstant(final BytePointer ptr) throws ClsFormatException {
final int tag = ClsUtil.readU1(ptr);
switch (tag) {
case ClsUtil.CONSTANT_Integer :
int value = ClsUtil.readU4(ptr);
return new IntegerConstantValue(value);
case ClsUtil.CONSTANT_Float:
float floatValue = ClsUtil.readFloat(ptr);
return new FloatConstantValue(floatValue);
case ClsUtil.CONSTANT_Long :
int high = ClsUtil.readU4(ptr);
int low = ClsUtil.readU4(ptr);
long v = ((long)high << 32) | (low & 0xFFFFFFFFL);
return new LongConstantValue(v);
case ClsUtil.CONSTANT_Double :
double doubleValue = ClsUtil.readDouble(ptr);
return new DoubleConstantValue(doubleValue);
case ClsUtil.CONSTANT_String :
int stringIndex = ClsUtil.readU2(ptr);
ptr.offset = getOffsetInConstantPool(stringIndex);
return new StringConstantValue(ClsUtil.readUtf8Info(ptr));
default : throw new ClsFormatException();
}
}
示例3: next
import com.intellij.util.cls.ClsUtil; //導入方法依賴的package包/類
/**
* Positions the pointer to the next entry
*/
public void next() throws ClsFormatException {
myPtr.offset = myCurrentOffset;
int tag = ClsUtil.readU1(myPtr);
switch(tag){
default:
throw new ClsFormatException();
case ClsUtil.CONSTANT_Class:
case ClsUtil.CONSTANT_String:
myPtr.offset += 2;
break;
case ClsUtil.CONSTANT_Fieldref:
case ClsUtil.CONSTANT_Methodref:
case ClsUtil.CONSTANT_InterfaceMethodref:
case ClsUtil.CONSTANT_Integer:
case ClsUtil.CONSTANT_Float:
case ClsUtil.CONSTANT_NameAndType:
myPtr.offset += 4;
break;
case ClsUtil.CONSTANT_Long:
case ClsUtil.CONSTANT_Double:
myPtr.offset += 8;
myCurrentEntryIndex++; // takes 2 entries
break;
case ClsUtil.CONSTANT_Utf8:
int length = ClsUtil.readU2(myPtr);
myPtr.offset += length;
break;
case ClsUtil.CONSTANT_MethodHandle:
myPtr.offset += 3;
break;
case ClsUtil.CONSTANT_MethodType:
myPtr.offset += 2;
break;
case ClsUtil.CONSTANT_InvokeDynamic:
myPtr.offset += 4;
break;
}
myCurrentEntryIndex++;
myCurrentOffset = myPtr.offset;
}
示例4: next
import com.intellij.util.cls.ClsUtil; //導入方法依賴的package包/類
/**
* Positions the pointer to the next entry
*/
public void next() throws ClsFormatException {
myPtr.offset = myCurrentOffset;
int tag = ClsUtil.readU1(myPtr);
switch(tag){
default:
throw new ClsFormatException();
case ClsUtil.CONSTANT_Class:
case ClsUtil.CONSTANT_String:
myPtr.offset += 2;
break;
case ClsUtil.CONSTANT_Fieldref:
case ClsUtil.CONSTANT_Methodref:
case ClsUtil.CONSTANT_InterfaceMethodref:
case ClsUtil.CONSTANT_Integer:
case ClsUtil.CONSTANT_Float:
case ClsUtil.CONSTANT_NameAndType:
myPtr.offset += 4;
break;
case ClsUtil.CONSTANT_Long:
case ClsUtil.CONSTANT_Double:
myPtr.offset += 8;
myCurrentEntryIndex++; // takes 2 entries
break;
case ClsUtil.CONSTANT_Utf8:
int length = ClsUtil.readU2(myPtr);
myPtr.offset += length;
break;
case ClsUtil.CONSTANT_MethodHandle:
myPtr.offset += 3;
break;
case ClsUtil.CONSTANT_MethodType:
myPtr.offset += 2;
break;
case ClsUtil.CONSTANT_InvokeDynamic:
myPtr.offset += 4;
break;
}
myCurrentEntryIndex++;
myCurrentOffset = myPtr.offset;
}