本文整理汇总了Java中org.jf.util.ExceptionWithContext类的典型用法代码示例。如果您正苦于以下问题:Java ExceptionWithContext类的具体用法?Java ExceptionWithContext怎么用?Java ExceptionWithContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExceptionWithContext类属于org.jf.util包,在下文中一共展示了ExceptionWithContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: build
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
public static DebugMethodItem build(RegisterFormatter registerFormatter, DebugItem debugItem) {
int codeAddress = debugItem.getCodeAddress();
switch (debugItem.getDebugItemType()) {
case DebugItemType.START_LOCAL:
return new StartLocalMethodItem(codeAddress, -1, registerFormatter, (StartLocal)debugItem);
case DebugItemType.END_LOCAL:
return new EndLocalMethodItem(codeAddress, -1, registerFormatter, (EndLocal)debugItem);
case DebugItemType.RESTART_LOCAL:
return new RestartLocalMethodItem(codeAddress, -1, registerFormatter, (RestartLocal)debugItem);
case DebugItemType.EPILOGUE_BEGIN:
return new BeginEpilogueMethodItem(codeAddress, -4);
case DebugItemType.PROLOGUE_END:
return new EndPrologueMethodItem(codeAddress, -4);
case DebugItemType.SET_SOURCE_FILE:
return new SetSourceFileMethodItem(codeAddress, -3, (SetSourceFile)debugItem);
case DebugItemType.LINE_NUMBER:
return new LineNumberMethodItem(codeAddress, -2, (LineNumber)debugItem);
default:
throw new ExceptionWithContext("Invalid debug item type: %d", debugItem.getDebugItemType());
}
}
开发者ID:alibaba,项目名称:atlas,代码行数:22,代码来源:DebugMethodItem.java
示例2: of
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
@Nonnull
public static ImmutableDebugItem of(DebugItem debugItem) {
if (debugItem instanceof ImmutableDebugItem) {
return (ImmutableDebugItem)debugItem;
}
switch (debugItem.getDebugItemType()) {
case DebugItemType.START_LOCAL:
return ImmutableStartLocal.of((StartLocal)debugItem);
case DebugItemType.END_LOCAL:
return ImmutableEndLocal.of((EndLocal)debugItem);
case DebugItemType.RESTART_LOCAL:
return ImmutableRestartLocal.of((RestartLocal)debugItem);
case DebugItemType.PROLOGUE_END:
return ImmutablePrologueEnd.of((PrologueEnd)debugItem);
case DebugItemType.EPILOGUE_BEGIN:
return ImmutableEpilogueBegin.of((EpilogueBegin)debugItem);
case DebugItemType.SET_SOURCE_FILE:
return ImmutableSetSourceFile.of((SetSourceFile)debugItem);
case DebugItemType.LINE_NUMBER:
return ImmutableLineNumber.of((LineNumber)debugItem);
default:
throw new ExceptionWithContext("Invalid debug item type: %d", debugItem.getDebugItemType());
}
}
开发者ID:CvvT,项目名称:andbg,代码行数:25,代码来源:ImmutableDebugItem.java
示例3: defaultValueForType
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
@Nonnull
public static EncodedValue defaultValueForType(String type) {
switch (type.charAt(0)) {
case 'Z':
return ImmutableBooleanEncodedValue.FALSE_VALUE;
case 'B':
return new ImmutableByteEncodedValue((byte)0);
case 'S':
return new ImmutableShortEncodedValue((short)0);
case 'C':
return new ImmutableCharEncodedValue((char)0);
case 'I':
return new ImmutableIntEncodedValue(0);
case 'J':
return new ImmutableLongEncodedValue(0);
case 'F':
return new ImmutableFloatEncodedValue(0);
case 'D':
return new ImmutableDoubleEncodedValue(0);
case 'L':
case '[':
return ImmutableNullEncodedValue.INSTANCE;
default:
throw new ExceptionWithContext("Unrecognized type: %s", type);
}
}
开发者ID:CvvT,项目名称:andbg,代码行数:27,代码来源:ImmutableEncodedValueFactory.java
示例4: of
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
@Nonnull
public static ImmutableReference of(Reference reference) {
if (reference instanceof StringReference) {
return ImmutableStringReference.of((StringReference)reference);
}
if (reference instanceof TypeReference) {
return ImmutableTypeReference.of((TypeReference)reference);
}
if (reference instanceof FieldReference) {
return ImmutableFieldReference.of((FieldReference)reference);
}
if (reference instanceof MethodReference) {
return ImmutableMethodReference.of((MethodReference)reference);
}
throw new ExceptionWithContext("Invalid reference type");
}
开发者ID:CvvT,项目名称:andbg,代码行数:17,代码来源:ImmutableReferenceFactory.java
示例5: writeLineNumber
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
public void writeLineNumber(int codeAddress, int lineNumber) throws IOException {
int lineDelta = lineNumber - currentLine;
int addressDelta = codeAddress - currentAddress;
if (addressDelta < 0) {
throw new ExceptionWithContext("debug info items must have non-decreasing code addresses");
}
if (lineDelta < -4 || lineDelta > 10) {
writeAdvanceLine(lineNumber);
lineDelta = 0;
} // no else is intentional here. we might need to advance the PC as well as the line
if ((lineDelta < 2 && addressDelta > 16) || (lineDelta > 1 && addressDelta > 15)) {
writeAdvancePC(codeAddress);
addressDelta = 0;
}
// we need to emit the special opcode even if both lineDelta and addressDelta are 0, otherwise a positions
// entry isn't generated
writeSpecialOpcode(lineDelta, addressDelta);
}
开发者ID:CvvT,项目名称:andbg,代码行数:21,代码来源:DebugWriter.java
示例6: defaultValueForType
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
@Nonnull
public static BuilderEncodedValue defaultValueForType(String type) {
switch (type.charAt(0)) {
case 'Z':
return BuilderBooleanEncodedValue.FALSE_VALUE;
case 'B':
return new BuilderByteEncodedValue((byte)0);
case 'S':
return new BuilderShortEncodedValue((short)0);
case 'C':
return new BuilderCharEncodedValue((char)0);
case 'I':
return new BuilderIntEncodedValue(0);
case 'J':
return new BuilderLongEncodedValue(0);
case 'F':
return new BuilderFloatEncodedValue(0);
case 'D':
return new BuilderDoubleEncodedValue(0);
case 'L':
case '[':
return BuilderNullEncodedValue.INSTANCE;
default:
throw new ExceptionWithContext("Unrecognized type: %s", type);
}
}
开发者ID:CvvT,项目名称:andbg,代码行数:27,代码来源:BuilderEncodedValues.java
示例7: ArrayProto
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
public ArrayProto(@Nonnull ClassPath classPath, @Nonnull String type) {
this.classPath = classPath;
int i=0;
while (type.charAt(i) == '[') {
i++;
if (i == type.length()) {
throw new ExceptionWithContext("Invalid array type: %s", type);
}
}
if (i == 0) {
throw new ExceptionWithContext("Invalid array type: %s", type);
}
dimensions = i;
elementType = type.substring(i);
}
开发者ID:CvvT,项目名称:andbg,代码行数:18,代码来源:ArrayProto.java
示例8: getWideRegisterType
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
@Nonnull
public static RegisterType getWideRegisterType(@Nonnull CharSequence type, boolean firstRegister) {
switch (type.charAt(0)) {
case 'J':
if (firstRegister) {
return getRegisterType(LONG_LO, null);
} else {
return getRegisterType(LONG_HI, null);
}
case 'D':
if (firstRegister) {
return getRegisterType(DOUBLE_LO, null);
} else {
return getRegisterType(DOUBLE_HI, null);
}
default:
throw new ExceptionWithContext("Cannot use this method for narrow register type: %s", type);
}
}
开发者ID:CvvT,项目名称:andbg,代码行数:20,代码来源:RegisterType.java
示例9: getRegisterType
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
@Nonnull
public static RegisterType getRegisterType(@Nonnull ClassPath classPath, @Nonnull CharSequence type) {
switch (type.charAt(0)) {
case 'Z':
return BOOLEAN_TYPE;
case 'B':
return BYTE_TYPE;
case 'S':
return SHORT_TYPE;
case 'C':
return CHAR_TYPE;
case 'I':
return INTEGER_TYPE;
case 'F':
return FLOAT_TYPE;
case 'J':
return LONG_LO_TYPE;
case 'D':
return DOUBLE_LO_TYPE;
case 'L':
case '[':
return getRegisterType(REFERENCE, classPath.getClass(type));
default:
throw new ExceptionWithContext("Invalid type: " + type);
}
}
开发者ID:CvvT,项目名称:andbg,代码行数:27,代码来源:RegisterType.java
示例10: skipUleb128
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
public void skipUleb128() {
int end = offset;
byte currentByteValue;
byte[] buf = dexBuf.buf;
currentByteValue = buf[end++];
if (currentByteValue < 0) { // if the MSB is set
currentByteValue = buf[end++];
if (currentByteValue < 0) { // if the MSB is set
currentByteValue = buf[end++];
if (currentByteValue < 0) { // if the MSB is set
currentByteValue = buf[end++];
if (currentByteValue < 0) { // if the MSB is set
currentByteValue = buf[end++];
if (currentByteValue < 0) {
throw new ExceptionWithContext(
"Invalid uleb128 integer encountered at offset 0x%x", offset);
}
}
}
}
}
offset = end;
}
开发者ID:CvvT,项目名称:andbg,代码行数:26,代码来源:BaseDexReader.java
示例11: verifyMagicAndByteOrder
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
private static void verifyMagicAndByteOrder(@Nonnull byte[] buf, int offset) {
if (!HeaderItem.verifyMagic(buf, offset)) {
StringBuilder sb = new StringBuilder("Invalid magic value:");
for (int i=0; i<8; i++) {
sb.append(String.format(" %02x", buf[i]));
}
throw new NotADexFile(sb.toString());
}
int endian = HeaderItem.getEndian(buf, offset);
if (endian == HeaderItem.BIG_ENDIAN_TAG) {
throw new ExceptionWithContext("Big endian dex files are not currently supported");
}
if (endian != HeaderItem.LITTLE_ENDIAN_TAG) {
throw new ExceptionWithContext("Invalid endian tag: 0x%x", endian);
}
}
开发者ID:CvvT,项目名称:andbg,代码行数:19,代码来源:DexBackedDexFile.java
示例12: of
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
public static ImmutableDebugItem of(DebugItem debugItem) {
if (debugItem instanceof ImmutableDebugItem) {
return (ImmutableDebugItem)debugItem;
}
switch (debugItem.getDebugItemType()) {
case DebugItemType.START_LOCAL:
return ImmutableStartLocal.of((StartLocal)debugItem);
case DebugItemType.END_LOCAL:
return ImmutableEndLocal.of((EndLocal)debugItem);
case DebugItemType.RESTART_LOCAL:
return ImmutableRestartLocal.of((RestartLocal)debugItem);
case DebugItemType.PROLOGUE_END:
return ImmutablePrologueEnd.of((PrologueEnd)debugItem);
case DebugItemType.EPILOGUE_BEGIN:
return ImmutableEpilogueBegin.of((EpilogueBegin)debugItem);
case DebugItemType.SET_SOURCE_FILE:
return ImmutableSetSourceFile.of((SetSourceFile)debugItem);
case DebugItemType.LINE_NUMBER:
return ImmutableLineNumber.of((LineNumber)debugItem);
default:
throw new ExceptionWithContext("Invalid debug item type: %d", debugItem.getDebugItemType());
}
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:24,代码来源:ImmutableDebugItem.java
示例13: of
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
public static ImmutableReference of(Reference reference) {
if (reference instanceof StringReference) {
return ImmutableStringReference.of((StringReference)reference);
}
if (reference instanceof TypeReference) {
return ImmutableTypeReference.of((TypeReference)reference);
}
if (reference instanceof FieldReference) {
return ImmutableFieldReference.of((FieldReference)reference);
}
if (reference instanceof MethodReference) {
return ImmutableMethodReference.of((MethodReference)reference);
}
if (reference instanceof MethodProtoReference) {
return ImmutableMethodProtoReference.of((MethodProtoReference) reference);
}
throw new ExceptionWithContext("Invalid reference type");
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:19,代码来源:ImmutableReferenceFactory.java
示例14: getReferenceIndex
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
private int getReferenceIndex(int referenceType, Reference reference) {
switch (referenceType) {
case ReferenceType.FIELD:
return fieldSection.getItemIndex((FieldRefKey) reference);
case ReferenceType.METHOD:
return methodSection.getItemIndex((MethodRefKey) reference);
case ReferenceType.STRING:
return stringSection.getItemIndex((StringRef) reference);
case ReferenceType.TYPE:
return typeSection.getItemIndex((TypeRef) reference);
case ReferenceType.METHOD_PROTO:
return protoSection.getItemIndex((ProtoRefKey) reference);
default:
throw new ExceptionWithContext("Unknown reference type: %d", referenceType);
}
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:17,代码来源:InstructionWriter.java
示例15: defaultValueForType
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
public static BuilderEncodedValue defaultValueForType(String type) {
switch (type.charAt(0)) {
case 'Z':
return BuilderBooleanEncodedValue.FALSE_VALUE;
case 'B':
return new BuilderByteEncodedValue((byte)0);
case 'S':
return new BuilderShortEncodedValue((short)0);
case 'C':
return new BuilderCharEncodedValue((char)0);
case 'I':
return new BuilderIntEncodedValue(0);
case 'J':
return new BuilderLongEncodedValue(0);
case 'F':
return new BuilderFloatEncodedValue(0);
case 'D':
return new BuilderDoubleEncodedValue(0);
case 'L':
case '[':
return BuilderNullEncodedValue.INSTANCE;
default:
throw new ExceptionWithContext("Unrecognized type: %s", type);
}
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:26,代码来源:BuilderEncodedValues.java
示例16: getTypeSize
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
private static int getTypeSize(char type) {
switch (type) {
case 'J':
case 'D':
return 8;
case '[':
case 'L':
case 'I':
case 'F':
return 4;
case 'C':
case 'S':
return 2;
case 'B':
case 'Z':
return 1;
}
throw new ExceptionWithContext("Invalid type: %s", type);
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:20,代码来源:ClassProto.java
示例17: ArrayProto
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
public ArrayProto( ClassPath classPath, String type) {
this.classPath = classPath;
int i=0;
while (type.charAt(i) == '[') {
i++;
if (i == type.length()) {
throw new ExceptionWithContext("Invalid array type: %s", type);
}
}
if (i == 0) {
throw new ExceptionWithContext("Invalid array type: %s", type);
}
dimensions = i;
elementType = type.substring(i);
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:18,代码来源:ArrayProto.java
示例18: readLongAsSmallUint
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
public int readLongAsSmallUint(int offset) {
byte[] buf = this.buf;
offset += baseOffset;
long result = (buf[offset] & 0xff) |
((buf[offset+1] & 0xff) << 8) |
((buf[offset+2] & 0xff) << 16) |
((buf[offset+3] & 0xffL) << 24) |
((buf[offset+4] & 0xffL) << 32) |
((buf[offset+5] & 0xffL) << 40) |
((buf[offset+6] & 0xffL) << 48) |
(((long)buf[offset+7]) << 56);
if (result < 0 || result > Integer.MAX_VALUE) {
throw new ExceptionWithContext("Encountered out-of-range ulong at offset 0x%x", offset);
}
return (int)result;
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:17,代码来源:BaseDexBuffer.java
示例19: makeReference
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
public static Reference makeReference( DexBackedDexFile dexFile, int referenceType, int referenceIndex) {
switch (referenceType) {
case ReferenceType.STRING:
return new DexBackedStringReference(dexFile, referenceIndex);
case ReferenceType.TYPE:
return new DexBackedTypeReference(dexFile, referenceIndex);
case ReferenceType.METHOD:
return new DexBackedMethodReference(dexFile, referenceIndex);
case ReferenceType.FIELD:
return new DexBackedFieldReference(dexFile, referenceIndex);
case ReferenceType.METHOD_PROTO:
return new DexBackedMethodProtoReference(dexFile, referenceIndex);
default:
throw new ExceptionWithContext("Invalid reference type: %d", referenceType);
}
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:17,代码来源:DexBackedReference.java
示例20: convertDebugItem
import org.jf.util.ExceptionWithContext; //导入依赖的package包/类
@Nonnull
private BuilderDebugItem convertDebugItem(@Nonnull DebugItem debugItem) {
switch (debugItem.getDebugItemType()) {
case DebugItemType.START_LOCAL: {
StartLocal startLocal = (StartLocal) debugItem;
return new BuilderStartLocal(startLocal.getRegister(),
(StringReference) convertReference(startLocal.getNameReference()),
(TypeReference) convertReference(startLocal.getTypeReference()),
(StringReference) convertReference(startLocal.getSignatureReference()));
}
case DebugItemType.END_LOCAL: {
EndLocal endLocal = (EndLocal) debugItem;
return new BuilderEndLocal(endLocal.getRegister());
}
case DebugItemType.RESTART_LOCAL: {
RestartLocal restartLocal = (RestartLocal) debugItem;
return new BuilderRestartLocal(restartLocal.getRegister());
}
case DebugItemType.PROLOGUE_END:
return new BuilderPrologueEnd();
case DebugItemType.EPILOGUE_BEGIN:
return new BuilderEpilogueBegin();
case DebugItemType.LINE_NUMBER: {
LineNumber lineNumber = (LineNumber) debugItem;
return new BuilderLineNumber(lineNumber.getLineNumber());
}
case DebugItemType.SET_SOURCE_FILE: {
SetSourceFile setSourceFile = (SetSourceFile) debugItem;
return new BuilderSetSourceFile(
(StringReference) convertReference(setSourceFile.getSourceFileReference())
);
}
default:
throw new ExceptionWithContext("Invalid debug item type: " + debugItem.getDebugItemType());
}
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:37,代码来源:BuilderMutableMethodImplementation.java
注:本文中的org.jf.util.ExceptionWithContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论