/** * Adds a direct ({@code static} and/or {@code private}) method. * * @param method {@code non-null;} the method to add */ public void addDirectMethod(EncodedMethod method) { classData.addDirectMethod(method); }
/** * Adds an instance field. * * @param field {@code non-null;} the field to add */ public void addInstanceField(EncodedField field) { classData.addInstanceField(field); }
/** * Adds a static field. * * @param field {@code non-null;} the field to add * @param value {@code null-ok;} initial value for the field, if any */ public void addStaticField(EncodedField field, Constant value) { classData.addStaticField(field, value); }
/** * Writes out the encoded form of this instance. * * @param file {@code non-null;} file this instance is part of * @param out {@code non-null;} where to write to */ private void encodeOutput(DexFile file, AnnotatedOutput out) { boolean annotates = out.annotates(); if (annotates) { out.annotate(0, offsetString() + " class data for " + thisClass.toHuman()); } encodeSize(file, out, "static_fields", staticFields.size()); encodeSize(file, out, "instance_fields", instanceFields.size()); encodeSize(file, out, "direct_methods", directMethods.size()); encodeSize(file, out, "virtual_methods", virtualMethods.size()); encodeList(file, out, "static_fields", staticFields); encodeList(file, out, "instance_fields", instanceFields); encodeList(file, out, "direct_methods", directMethods); encodeList(file, out, "virtual_methods", virtualMethods); if (annotates) { out.endAnnotation(); } }
/** {@inheritDoc} */ @Override protected void place0(Section addedTo, int offset) { // Encode the data and note the size. ByteArrayAnnotatedOutput out = new ByteArrayAnnotatedOutput(); encodeOutput(addedTo.getFile(), out); encodedForm = out.toByteArray(); setWriteSize(encodedForm.length); }
int sourceFileIdx = (sourceFile == null) ? -1 : file.getStringIds().indexOf(sourceFile); int dataOff = classData.isEmpty()? 0 : classData.getAbsoluteOffset(); int staticValuesOff = OffsettedItem.getAbsoluteOffsetOr0(staticValuesItem);
/** * Gets all the methods in this class. The returned list is not linked * in any way to the underlying lists contained in this instance, but * the objects contained in the list are shared. * * @return {@code non-null;} list of all methods */ public ArrayList<EncodedMethod> getMethods() { return classData.getMethods(); }
/** * Adds a virtual method. * * @param method {@code non-null;} the method to add */ public void addVirtualMethod(EncodedMethod method) { classData.addVirtualMethod(method); }
/** {@inheritDoc} */ @Override public void writeTo0(DexFile file, AnnotatedOutput out) { boolean annotates = out.annotates(); if (annotates) { /* * The output is to be annotated, so redo the work previously * done by place0(), except this time annotations will actually * get emitted. */ encodeOutput(file, out); } else { out.write(encodedForm); } } }
(interfaces.size() == 0) ? null : new TypeListItem(interfaces); this.sourceFile = sourceFile; this.classData = new ClassDataItem(thisClass); this.staticValuesItem = null; this.annotationsDirectory = new AnnotationsDirectoryItem();
/** * Writes out the encoded form of this instance. * * @param file {@code non-null;} file this instance is part of * @param out {@code non-null;} where to write to */ private void encodeOutput(DexFile file, AnnotatedOutput out) { boolean annotates = out.annotates(); if (annotates) { out.annotate(0, offsetString() + " class data for " + thisClass.toHuman()); } encodeSize(file, out, "static_fields", staticFields.size()); encodeSize(file, out, "instance_fields", instanceFields.size()); encodeSize(file, out, "direct_methods", directMethods.size()); encodeSize(file, out, "virtual_methods", virtualMethods.size()); encodeList(file, out, "static_fields", staticFields); encodeList(file, out, "instance_fields", instanceFields); encodeList(file, out, "direct_methods", directMethods); encodeList(file, out, "virtual_methods", virtualMethods); if (annotates) { out.endAnnotation(); } }
/** {@inheritDoc} */ @Override protected void place0(Section addedTo, int offset) { // Encode the data and note the size. ByteArrayAnnotatedOutput out = new ByteArrayAnnotatedOutput(); encodeOutput(addedTo.getFile(), out); encodedForm = out.toByteArray(); setWriteSize(encodedForm.length); }
int sourceFileIdx = (sourceFile == null) ? -1 : file.getStringIds().indexOf(sourceFile); int dataOff = classData.isEmpty()? 0 : classData.getAbsoluteOffset(); int staticValuesOff = OffsettedItem.getAbsoluteOffsetOr0(staticValuesItem);
/** * Gets all the methods in this class. The returned list is not linked * in any way to the underlying lists contained in this instance, but * the objects contained in the list are shared. * * @return {@code non-null;} list of all methods */ public ArrayList<EncodedMethod> getMethods() { return classData.getMethods(); }
/** * Adds a virtual method. * * @param method {@code non-null;} the method to add */ public void addVirtualMethod(EncodedMethod method) { classData.addVirtualMethod(method); }
/** {@inheritDoc} */ @Override public void writeTo0(DexFile file, AnnotatedOutput out) { boolean annotates = out.annotates(); if (annotates) { /* * The output is to be annotated, so redo the work previously * done by place0(), except this time annotations will actually * get emitted. */ encodeOutput(file, out); } else { out.write(encodedForm); } } }
(interfaces.size() == 0) ? null : new TypeListItem(interfaces); this.sourceFile = sourceFile; this.classData = new ClassDataItem(thisClass); this.staticValuesItem = null; this.annotationsDirectory = new AnnotationsDirectoryItem();
/** * Writes out the encoded form of this instance. * * @param file {@code non-null;} file this instance is part of * @param out {@code non-null;} where to write to */ private void encodeOutput(DexFile file, AnnotatedOutput out) { boolean annotates = out.annotates(); if (annotates) { out.annotate(0, offsetString() + " class data for " + thisClass.toHuman()); } encodeSize(file, out, "static_fields", staticFields.size()); encodeSize(file, out, "instance_fields", instanceFields.size()); encodeSize(file, out, "direct_methods", directMethods.size()); encodeSize(file, out, "virtual_methods", virtualMethods.size()); encodeList(file, out, "static_fields", staticFields); encodeList(file, out, "instance_fields", instanceFields); encodeList(file, out, "direct_methods", directMethods); encodeList(file, out, "virtual_methods", virtualMethods); if (annotates) { out.endAnnotation(); } }
/** {@inheritDoc} */ @Override protected void place0(Section addedTo, int offset) { // Encode the data and note the size. ByteArrayAnnotatedOutput out = new ByteArrayAnnotatedOutput(); encodeOutput(addedTo.getFile(), out); encodedForm = out.toByteArray(); setWriteSize(encodedForm.length); }
int sourceFileIdx = (sourceFile == null) ? -1 : file.getStringIds().indexOf(sourceFile); int dataOff = classData.isEmpty()? 0 : classData.getAbsoluteOffset(); int staticValuesOff = OffsettedItem.getAbsoluteOffsetOr0(staticValuesItem);