/** * Calculates the size of this <code>EncodedField</code> and returns the offset * immediately following it * @param offset the offset of this <code>EncodedField</code> in the <code>DexFile</code> * @param previousEncodedField The previous <code>EncodedField</code> in the list containing this * <code>EncodedField</code>. * @return the offset immediately following this <code>EncodedField</code> */ private int place(int offset, EncodedField previousEncodedField) { int previousIndex = previousEncodedField==null?0:previousEncodedField.field.getIndex(); offset += Leb128Utils.unsignedLeb128Size(field.getIndex() - previousIndex); offset += Leb128Utils.unsignedLeb128Size(accessFlags); return offset; }
/** {@inheritDoc} */ public int placeValue(int offset) { return offset + EncodedValueUtils.getRequiredBytesForUnsignedIntegralValue(value.getIndex()) + 1; }
/** {@inheritDoc} */ public int placeValue(int offset) { return offset + EncodedValueUtils.getRequiredBytesForUnsignedIntegralValue(value.getIndex()) + 1; }
/** * This is used internally to construct a new <code>EncodedField</code> while reading in a <code>DexFile</code> * @param dexFile The <code>DexFile</code> that is being read in * @param in the Input object to read the <code>EncodedField</code> from * @param previousEncodedField The previous <code>EncodedField</code> in the list containing this * <code>EncodedField</code>. */ private EncodedField(DexFile dexFile, Input in, EncodedField previousEncodedField) { int previousIndex = previousEncodedField==null?0:previousEncodedField.field.getIndex(); field = dexFile.FieldIdsSection.getItemByIndex(in.readUnsignedLeb128() + previousIndex); accessFlags = in.readUnsignedLeb128(); }
/** * Writes the <code>EncodedField</code> to the given <code>AnnotatedOutput</code> object * @param out the <code>AnnotatedOutput</code> object to write to * @param previousEncodedField The previous <code>EncodedField</code> in the list containing this * <code>EncodedField</code>. */ private void writeTo(AnnotatedOutput out, EncodedField previousEncodedField) { int previousIndex = previousEncodedField==null?0:previousEncodedField.field.getIndex(); if (out.annotates()) { out.annotate("field: " + field.getFieldString()); out.writeUnsignedLeb128(field.getIndex() - previousIndex); out.annotate("access_flags: " + AccessFlags.formatAccessFlagsForField(accessFlags)); out.writeUnsignedLeb128(accessFlags); }else { out.writeUnsignedLeb128(field.getIndex() - previousIndex); out.writeUnsignedLeb128(accessFlags); } }
/** {@inheritDoc} */ public void writeValue(AnnotatedOutput out) { byte[] bytes = EncodedValueUtils.encodeUnsignedIntegralValue(value.getIndex()); if (out.annotates()) { out.annotate(1, "value_type=" + ValueType.VALUE_ENUM.name() + ",value_arg=" + (bytes.length - 1)); out.annotate(bytes.length, "value: " + value.getFieldString()); } out.writeByte(ValueType.VALUE_ENUM.value | ((bytes.length - 1) << 5)); out.write(bytes); }
/** {@inheritDoc} */ public void writeValue(AnnotatedOutput out) { byte[] bytes = EncodedValueUtils.encodeUnsignedIntegralValue(value.getIndex()); if (out.annotates()) { out.annotate(1, "value_type=" + ValueType.VALUE_FIELD.name() + ",value_arg=" + (bytes.length - 1)); out.annotate(bytes.length, "value: " + value.getFieldString()); } out.writeByte(ValueType.VALUE_FIELD.value | ((bytes.length - 1) << 5)); out.write(bytes); }
out.writeInt(fieldAnnotationFields[i].getIndex()); out.writeInt(fieldAnnotations[i].getOffset());
/** * Calculates the size of this <code>EncodedField</code> and returns the offset * immediately following it * @param offset the offset of this <code>EncodedField</code> in the <code>DexFile</code> * @param previousEncodedField The previous <code>EncodedField</code> in the list containing this * <code>EncodedField</code>. * @return the offset immediately following this <code>EncodedField</code> */ private int place(int offset, EncodedField previousEncodedField) { int previousIndex = previousEncodedField==null?0:previousEncodedField.field.getIndex(); offset += Leb128Utils.unsignedLeb128Size(field.getIndex() - previousIndex); offset += Leb128Utils.unsignedLeb128Size(accessFlags); return offset; }
/** {@inheritDoc} */ public int placeValue(int offset) { return offset + EncodedValueUtils.getRequiredBytesForUnsignedIntegralValue(value.getIndex()) + 1; }
/** {@inheritDoc} */ public int placeValue(int offset) { return offset + EncodedValueUtils.getRequiredBytesForUnsignedIntegralValue(value.getIndex()) + 1; }
/** {@inheritDoc} */ public void writeValue(AnnotatedOutput out) { byte[] bytes = EncodedValueUtils.encodeUnsignedIntegralValue(value.getIndex()); if (out.annotates()) { out.annotate(1, "value_type=" + ValueType.VALUE_ENUM.name() + ",value_arg=" + (bytes.length - 1)); out.annotate(bytes.length, "value: " + value.getFieldString()); } out.writeByte(ValueType.VALUE_ENUM.value | ((bytes.length - 1) << 5)); out.write(bytes); }
/** {@inheritDoc} */ public void writeValue(AnnotatedOutput out) { byte[] bytes = EncodedValueUtils.encodeUnsignedIntegralValue(value.getIndex()); if (out.annotates()) { out.annotate(1, "value_type=" + ValueType.VALUE_FIELD.name() + ",value_arg=" + (bytes.length - 1)); out.annotate(bytes.length, "value: " + value.getFieldString()); } out.writeByte(ValueType.VALUE_FIELD.value | ((bytes.length - 1) << 5)); out.write(bytes); }