Esempio n. 1
0
    /**
     * 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);
      }
    }
Esempio n. 2
0
    /**
     * Writes the <code>EncodedMethod</code> to the given <code>AnnotatedOutput</code> object
     *
     * @param out the <code>AnnotatedOutput</code> object to write to
     * @param previousEncodedMethod The previous <code>EncodedMethod</code> in the list containing
     *     this <code>EncodedMethod</code>.
     */
    private void writeTo(AnnotatedOutput out, EncodedMethod previousEncodedMethod) {
      int previousIndex =
          previousEncodedMethod == null ? 0 : previousEncodedMethod.method.getIndex();

      if (out.annotates()) {
        out.annotate("method: " + method.getMethodString());
        out.writeUnsignedLeb128(method.getIndex() - previousIndex);
        out.annotate("access_flags: " + AccessFlags.formatAccessFlagsForMethod(accessFlags));
        out.writeUnsignedLeb128(accessFlags);
        if (codeItem != null) {
          out.annotate("code_off: 0x" + Integer.toHexString(codeItem.getOffset()));
          out.writeUnsignedLeb128(codeItem.getOffset());
        } else {
          out.annotate("code_off: 0x0");
          out.writeUnsignedLeb128(0);
        }
      } else {
        out.writeUnsignedLeb128(method.getIndex() - previousIndex);
        out.writeUnsignedLeb128(accessFlags);
        out.writeUnsignedLeb128(codeItem == null ? 0 : codeItem.getOffset());
      }
    }