Java Code Examples for org.jf.dexlib2.dexbacked.DexReader#getOffset()
The following examples show how to use
org.jf.dexlib2.dexbacked.DexReader#getOffset() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DexBackedAnnotationEncodedValue.java From ZjDroid with Apache License 2.0 | 5 votes |
public DexBackedAnnotationEncodedValue(@Nonnull DexReader reader) { this.dexFile = reader.dexBuf; this.type = dexFile.getType(reader.readSmallUleb128()); this.elementCount = reader.readSmallUleb128(); this.elementsOffset = reader.getOffset(); skipElements(reader, elementCount); }
Example 2
Source File: DexBackedAnnotationEncodedValue.java From zjdroid with Apache License 2.0 | 5 votes |
public DexBackedAnnotationEncodedValue(@Nonnull DexReader reader) { this.dexFile = reader.dexBuf; this.type = dexFile.getType(reader.readSmallUleb128()); this.elementCount = reader.readSmallUleb128(); this.elementsOffset = reader.getOffset(); skipElements(reader, elementCount); }
Example 3
Source File: DexBackedAnnotationEncodedValue.java From HeyGirl with Apache License 2.0 | 5 votes |
public DexBackedAnnotationEncodedValue(@Nonnull DexReader reader) { this.dexFile = reader.dexBuf; this.type = dexFile.getType(reader.readSmallUleb128()); this.elementCount = reader.readSmallUleb128(); this.elementsOffset = reader.getOffset(); skipElements(reader, elementCount); }
Example 4
Source File: DexBackedAnnotationEncodedValue.java From ZjDroid with Apache License 2.0 | 5 votes |
public DexBackedAnnotationEncodedValue(@Nonnull DexReader reader) { this.dexFile = reader.dexBuf; this.type = dexFile.getType(reader.readSmallUleb128()); this.elementCount = reader.readSmallUleb128(); this.elementsOffset = reader.getOffset(); skipElements(reader, elementCount); }
Example 5
Source File: DexBackedArrayEncodedValue.java From ZjDroid with Apache License 2.0 | 4 votes |
public DexBackedArrayEncodedValue(@Nonnull DexReader reader) { this.dexFile = reader.dexBuf; this.elementCount = reader.readSmallUleb128(); this.encodedArrayOffset = reader.getOffset(); skipElementsFrom(reader, elementCount); }
Example 6
Source File: DexBackedEncodedValue.java From ZjDroid with Apache License 2.0 | 4 votes |
@Nonnull public static EncodedValue readFrom(@Nonnull DexReader reader) { int startOffset = reader.getOffset(); try { int b = reader.readUbyte(); int valueType = b & 0x1f; int valueArg = b >>> 5; switch (valueType) { case ValueType.BYTE: Preconditions.checkValueArg(valueArg, 0); return new ImmutableByteEncodedValue((byte)reader.readByte()); case ValueType.SHORT: Preconditions.checkValueArg(valueArg, 1); return new ImmutableShortEncodedValue((short)reader.readSizedInt(valueArg + 1)); case ValueType.CHAR: Preconditions.checkValueArg(valueArg, 1); return new ImmutableCharEncodedValue((char)reader.readSizedSmallUint(valueArg + 1)); case ValueType.INT: Preconditions.checkValueArg(valueArg, 3); return new ImmutableIntEncodedValue(reader.readSizedInt(valueArg + 1)); case ValueType.LONG: Preconditions.checkValueArg(valueArg, 7); return new ImmutableLongEncodedValue(reader.readSizedLong(valueArg + 1)); case ValueType.FLOAT: Preconditions.checkValueArg(valueArg, 3); return new ImmutableFloatEncodedValue(Float.intBitsToFloat( reader.readSizedRightExtendedInt(valueArg + 1))); case ValueType.DOUBLE: Preconditions.checkValueArg(valueArg, 7); return new ImmutableDoubleEncodedValue(Double.longBitsToDouble( reader.readSizedRightExtendedLong(valueArg + 1))); case ValueType.STRING: Preconditions.checkValueArg(valueArg, 3); return new DexBackedStringEncodedValue(reader, valueArg); case ValueType.TYPE: Preconditions.checkValueArg(valueArg, 3); return new DexBackedTypeEncodedValue(reader, valueArg); case ValueType.FIELD: Preconditions.checkValueArg(valueArg, 3); return new DexBackedFieldEncodedValue(reader, valueArg); case ValueType.METHOD: Preconditions.checkValueArg(valueArg, 3); return new DexBackedMethodEncodedValue(reader, valueArg); case ValueType.ENUM: Preconditions.checkValueArg(valueArg, 3); return new DexBackedEnumEncodedValue(reader, valueArg); case ValueType.ARRAY: Preconditions.checkValueArg(valueArg, 0); return new DexBackedArrayEncodedValue(reader); case ValueType.ANNOTATION: Preconditions.checkValueArg(valueArg, 0); return new DexBackedAnnotationEncodedValue(reader); case ValueType.NULL: Preconditions.checkValueArg(valueArg, 0); return ImmutableNullEncodedValue.INSTANCE; case ValueType.BOOLEAN: Preconditions.checkValueArg(valueArg, 1); return ImmutableBooleanEncodedValue.forBoolean(valueArg == 1); default: throw new ExceptionWithContext("Invalid encoded_value type: 0x%x", valueType); } } catch (Exception ex) { throw ExceptionWithContext.withContext(ex, "Error while reading encoded value at offset 0x%x", startOffset); } }
Example 7
Source File: DexBackedEncodedValue.java From ZjDroid with Apache License 2.0 | 4 votes |
public static void skipFrom(@Nonnull DexReader reader) { int startOffset = reader.getOffset(); try { int b = reader.readUbyte(); int valueType = b & 0x1f; switch (valueType) { case ValueType.BYTE: reader.skipByte(); break; case ValueType.SHORT: case ValueType.CHAR: case ValueType.INT: case ValueType.LONG: case ValueType.FLOAT: case ValueType.DOUBLE: case ValueType.STRING: case ValueType.TYPE: case ValueType.FIELD: case ValueType.METHOD: case ValueType.ENUM: int valueArg = b >>> 5; reader.moveRelative(valueArg+1); break; case ValueType.ARRAY: DexBackedArrayEncodedValue.skipFrom(reader); break; case ValueType.ANNOTATION: DexBackedAnnotationEncodedValue.skipFrom(reader); break; case ValueType.NULL: case ValueType.BOOLEAN: break; default: throw new ExceptionWithContext("Invalid encoded_value type: 0x%x", valueType); } } catch (Exception ex) { throw ExceptionWithContext.withContext(ex, "Error while skipping encoded value at offset 0x%x", startOffset); } }
Example 8
Source File: DexBackedArrayEncodedValue.java From zjdroid with Apache License 2.0 | 4 votes |
public DexBackedArrayEncodedValue(@Nonnull DexReader reader) { this.dexFile = reader.dexBuf; this.elementCount = reader.readSmallUleb128(); this.encodedArrayOffset = reader.getOffset(); skipElementsFrom(reader, elementCount); }
Example 9
Source File: DexBackedEncodedValue.java From zjdroid with Apache License 2.0 | 4 votes |
@Nonnull public static EncodedValue readFrom(@Nonnull DexReader reader) { int startOffset = reader.getOffset(); try { int b = reader.readUbyte(); int valueType = b & 0x1f; int valueArg = b >>> 5; switch (valueType) { case ValueType.BYTE: Preconditions.checkValueArg(valueArg, 0); return new ImmutableByteEncodedValue((byte)reader.readByte()); case ValueType.SHORT: Preconditions.checkValueArg(valueArg, 1); return new ImmutableShortEncodedValue((short)reader.readSizedInt(valueArg + 1)); case ValueType.CHAR: Preconditions.checkValueArg(valueArg, 1); return new ImmutableCharEncodedValue((char)reader.readSizedSmallUint(valueArg + 1)); case ValueType.INT: Preconditions.checkValueArg(valueArg, 3); return new ImmutableIntEncodedValue(reader.readSizedInt(valueArg + 1)); case ValueType.LONG: Preconditions.checkValueArg(valueArg, 7); return new ImmutableLongEncodedValue(reader.readSizedLong(valueArg + 1)); case ValueType.FLOAT: Preconditions.checkValueArg(valueArg, 3); return new ImmutableFloatEncodedValue(Float.intBitsToFloat( reader.readSizedRightExtendedInt(valueArg + 1))); case ValueType.DOUBLE: Preconditions.checkValueArg(valueArg, 7); return new ImmutableDoubleEncodedValue(Double.longBitsToDouble( reader.readSizedRightExtendedLong(valueArg + 1))); case ValueType.STRING: Preconditions.checkValueArg(valueArg, 3); return new DexBackedStringEncodedValue(reader, valueArg); case ValueType.TYPE: Preconditions.checkValueArg(valueArg, 3); return new DexBackedTypeEncodedValue(reader, valueArg); case ValueType.FIELD: Preconditions.checkValueArg(valueArg, 3); return new DexBackedFieldEncodedValue(reader, valueArg); case ValueType.METHOD: Preconditions.checkValueArg(valueArg, 3); return new DexBackedMethodEncodedValue(reader, valueArg); case ValueType.ENUM: Preconditions.checkValueArg(valueArg, 3); return new DexBackedEnumEncodedValue(reader, valueArg); case ValueType.ARRAY: Preconditions.checkValueArg(valueArg, 0); return new DexBackedArrayEncodedValue(reader); case ValueType.ANNOTATION: Preconditions.checkValueArg(valueArg, 0); return new DexBackedAnnotationEncodedValue(reader); case ValueType.NULL: Preconditions.checkValueArg(valueArg, 0); return ImmutableNullEncodedValue.INSTANCE; case ValueType.BOOLEAN: Preconditions.checkValueArg(valueArg, 1); return ImmutableBooleanEncodedValue.forBoolean(valueArg == 1); default: throw new ExceptionWithContext("Invalid encoded_value type: 0x%x", valueType); } } catch (Exception ex) { throw ExceptionWithContext.withContext(ex, "Error while reading encoded value at offset 0x%x", startOffset); } }
Example 10
Source File: DexBackedEncodedValue.java From zjdroid with Apache License 2.0 | 4 votes |
public static void skipFrom(@Nonnull DexReader reader) { int startOffset = reader.getOffset(); try { int b = reader.readUbyte(); int valueType = b & 0x1f; switch (valueType) { case ValueType.BYTE: reader.skipByte(); break; case ValueType.SHORT: case ValueType.CHAR: case ValueType.INT: case ValueType.LONG: case ValueType.FLOAT: case ValueType.DOUBLE: case ValueType.STRING: case ValueType.TYPE: case ValueType.FIELD: case ValueType.METHOD: case ValueType.ENUM: int valueArg = b >>> 5; reader.moveRelative(valueArg+1); break; case ValueType.ARRAY: DexBackedArrayEncodedValue.skipFrom(reader); break; case ValueType.ANNOTATION: DexBackedAnnotationEncodedValue.skipFrom(reader); break; case ValueType.NULL: case ValueType.BOOLEAN: break; default: throw new ExceptionWithContext("Invalid encoded_value type: 0x%x", valueType); } } catch (Exception ex) { throw ExceptionWithContext.withContext(ex, "Error while skipping encoded value at offset 0x%x", startOffset); } }
Example 11
Source File: DexBackedArrayEncodedValue.java From HeyGirl with Apache License 2.0 | 4 votes |
public DexBackedArrayEncodedValue(@Nonnull DexReader reader) { this.dexFile = reader.dexBuf; this.elementCount = reader.readSmallUleb128(); this.encodedArrayOffset = reader.getOffset(); skipElementsFrom(reader, elementCount); }
Example 12
Source File: DexBackedEncodedValue.java From HeyGirl with Apache License 2.0 | 4 votes |
@Nonnull public static EncodedValue readFrom(@Nonnull DexReader reader) { int startOffset = reader.getOffset(); try { int b = reader.readUbyte(); int valueType = b & 0x1f; int valueArg = b >>> 5; switch (valueType) { case ValueType.BYTE: Preconditions.checkValueArg(valueArg, 0); return new ImmutableByteEncodedValue((byte)reader.readByte()); case ValueType.SHORT: Preconditions.checkValueArg(valueArg, 1); return new ImmutableShortEncodedValue((short)reader.readSizedInt(valueArg + 1)); case ValueType.CHAR: Preconditions.checkValueArg(valueArg, 1); return new ImmutableCharEncodedValue((char)reader.readSizedSmallUint(valueArg + 1)); case ValueType.INT: Preconditions.checkValueArg(valueArg, 3); return new ImmutableIntEncodedValue(reader.readSizedInt(valueArg + 1)); case ValueType.LONG: Preconditions.checkValueArg(valueArg, 7); return new ImmutableLongEncodedValue(reader.readSizedLong(valueArg + 1)); case ValueType.FLOAT: Preconditions.checkValueArg(valueArg, 3); return new ImmutableFloatEncodedValue(Float.intBitsToFloat( reader.readSizedRightExtendedInt(valueArg + 1))); case ValueType.DOUBLE: Preconditions.checkValueArg(valueArg, 7); return new ImmutableDoubleEncodedValue(Double.longBitsToDouble( reader.readSizedRightExtendedLong(valueArg + 1))); case ValueType.STRING: Preconditions.checkValueArg(valueArg, 3); return new DexBackedStringEncodedValue(reader, valueArg); case ValueType.TYPE: Preconditions.checkValueArg(valueArg, 3); return new DexBackedTypeEncodedValue(reader, valueArg); case ValueType.FIELD: Preconditions.checkValueArg(valueArg, 3); return new DexBackedFieldEncodedValue(reader, valueArg); case ValueType.METHOD: Preconditions.checkValueArg(valueArg, 3); return new DexBackedMethodEncodedValue(reader, valueArg); case ValueType.ENUM: Preconditions.checkValueArg(valueArg, 3); return new DexBackedEnumEncodedValue(reader, valueArg); case ValueType.ARRAY: Preconditions.checkValueArg(valueArg, 0); return new DexBackedArrayEncodedValue(reader); case ValueType.ANNOTATION: Preconditions.checkValueArg(valueArg, 0); return new DexBackedAnnotationEncodedValue(reader); case ValueType.NULL: Preconditions.checkValueArg(valueArg, 0); return ImmutableNullEncodedValue.INSTANCE; case ValueType.BOOLEAN: Preconditions.checkValueArg(valueArg, 1); return ImmutableBooleanEncodedValue.forBoolean(valueArg == 1); default: throw new ExceptionWithContext("Invalid encoded_value type: 0x%x", valueType); } } catch (Exception ex) { throw ExceptionWithContext.withContext(ex, "Error while reading encoded value at offset 0x%x", startOffset); } }
Example 13
Source File: DexBackedEncodedValue.java From HeyGirl with Apache License 2.0 | 4 votes |
public static void skipFrom(@Nonnull DexReader reader) { int startOffset = reader.getOffset(); try { int b = reader.readUbyte(); int valueType = b & 0x1f; switch (valueType) { case ValueType.BYTE: reader.skipByte(); break; case ValueType.SHORT: case ValueType.CHAR: case ValueType.INT: case ValueType.LONG: case ValueType.FLOAT: case ValueType.DOUBLE: case ValueType.STRING: case ValueType.TYPE: case ValueType.FIELD: case ValueType.METHOD: case ValueType.ENUM: int valueArg = b >>> 5; reader.moveRelative(valueArg+1); break; case ValueType.ARRAY: DexBackedArrayEncodedValue.skipFrom(reader); break; case ValueType.ANNOTATION: DexBackedAnnotationEncodedValue.skipFrom(reader); break; case ValueType.NULL: case ValueType.BOOLEAN: break; default: throw new ExceptionWithContext("Invalid encoded_value type: 0x%x", valueType); } } catch (Exception ex) { throw ExceptionWithContext.withContext(ex, "Error while skipping encoded value at offset 0x%x", startOffset); } }
Example 14
Source File: DexBackedArrayEncodedValue.java From ZjDroid with Apache License 2.0 | 4 votes |
public DexBackedArrayEncodedValue(@Nonnull DexReader reader) { this.dexFile = reader.dexBuf; this.elementCount = reader.readSmallUleb128(); this.encodedArrayOffset = reader.getOffset(); skipElementsFrom(reader, elementCount); }
Example 15
Source File: DexBackedEncodedValue.java From ZjDroid with Apache License 2.0 | 4 votes |
@Nonnull public static EncodedValue readFrom(@Nonnull DexReader reader) { int startOffset = reader.getOffset(); try { int b = reader.readUbyte(); int valueType = b & 0x1f; int valueArg = b >>> 5; switch (valueType) { case ValueType.BYTE: Preconditions.checkValueArg(valueArg, 0); return new ImmutableByteEncodedValue((byte)reader.readByte()); case ValueType.SHORT: Preconditions.checkValueArg(valueArg, 1); return new ImmutableShortEncodedValue((short)reader.readSizedInt(valueArg + 1)); case ValueType.CHAR: Preconditions.checkValueArg(valueArg, 1); return new ImmutableCharEncodedValue((char)reader.readSizedSmallUint(valueArg + 1)); case ValueType.INT: Preconditions.checkValueArg(valueArg, 3); return new ImmutableIntEncodedValue(reader.readSizedInt(valueArg + 1)); case ValueType.LONG: Preconditions.checkValueArg(valueArg, 7); return new ImmutableLongEncodedValue(reader.readSizedLong(valueArg + 1)); case ValueType.FLOAT: Preconditions.checkValueArg(valueArg, 3); return new ImmutableFloatEncodedValue(Float.intBitsToFloat( reader.readSizedRightExtendedInt(valueArg + 1))); case ValueType.DOUBLE: Preconditions.checkValueArg(valueArg, 7); return new ImmutableDoubleEncodedValue(Double.longBitsToDouble( reader.readSizedRightExtendedLong(valueArg + 1))); case ValueType.STRING: Preconditions.checkValueArg(valueArg, 3); return new DexBackedStringEncodedValue(reader, valueArg); case ValueType.TYPE: Preconditions.checkValueArg(valueArg, 3); return new DexBackedTypeEncodedValue(reader, valueArg); case ValueType.FIELD: Preconditions.checkValueArg(valueArg, 3); return new DexBackedFieldEncodedValue(reader, valueArg); case ValueType.METHOD: Preconditions.checkValueArg(valueArg, 3); return new DexBackedMethodEncodedValue(reader, valueArg); case ValueType.ENUM: Preconditions.checkValueArg(valueArg, 3); return new DexBackedEnumEncodedValue(reader, valueArg); case ValueType.ARRAY: Preconditions.checkValueArg(valueArg, 0); return new DexBackedArrayEncodedValue(reader); case ValueType.ANNOTATION: Preconditions.checkValueArg(valueArg, 0); return new DexBackedAnnotationEncodedValue(reader); case ValueType.NULL: Preconditions.checkValueArg(valueArg, 0); return ImmutableNullEncodedValue.INSTANCE; case ValueType.BOOLEAN: Preconditions.checkValueArg(valueArg, 1); return ImmutableBooleanEncodedValue.forBoolean(valueArg == 1); default: throw new ExceptionWithContext("Invalid encoded_value type: 0x%x", valueType); } } catch (Exception ex) { throw ExceptionWithContext.withContext(ex, "Error while reading encoded value at offset 0x%x", startOffset); } }
Example 16
Source File: DexBackedEncodedValue.java From ZjDroid with Apache License 2.0 | 4 votes |
public static void skipFrom(@Nonnull DexReader reader) { int startOffset = reader.getOffset(); try { int b = reader.readUbyte(); int valueType = b & 0x1f; switch (valueType) { case ValueType.BYTE: reader.skipByte(); break; case ValueType.SHORT: case ValueType.CHAR: case ValueType.INT: case ValueType.LONG: case ValueType.FLOAT: case ValueType.DOUBLE: case ValueType.STRING: case ValueType.TYPE: case ValueType.FIELD: case ValueType.METHOD: case ValueType.ENUM: int valueArg = b >>> 5; reader.moveRelative(valueArg+1); break; case ValueType.ARRAY: DexBackedArrayEncodedValue.skipFrom(reader); break; case ValueType.ANNOTATION: DexBackedAnnotationEncodedValue.skipFrom(reader); break; case ValueType.NULL: case ValueType.BOOLEAN: break; default: throw new ExceptionWithContext("Invalid encoded_value type: 0x%x", valueType); } } catch (Exception ex) { throw ExceptionWithContext.withContext(ex, "Error while skipping encoded value at offset 0x%x", startOffset); } }