/** {@inheritDoc} */ @Override protected void place0(Section addedTo, int offset) { // Encode the data and note the size. ByteArrayAnnotatedOutput out = new ByteArrayAnnotatedOutput(); ValueEncoder encoder = new ValueEncoder(addedTo.getFile(), out); encoder.writeArray(array, false); encodedForm = out.toByteArray(); setWriteSize(encodedForm.length); }
/** {@inheritDoc} */ @Override public void addContents(DexFile file) { ValueEncoder.addContents(file, array); }
/** * Gets the colloquial type name and human form of the type of the * given constant, when used as an encoded value. * * @param cst {@code non-null;} the constant * @return {@code non-null;} its type name and human form */ public static String constantToHuman(Constant cst) { int type = constantToValueType(cst); if (type == VALUE_NULL) { return "null"; } StringBuilder sb = new StringBuilder(); sb.append(cst.typeName()); sb.append(' '); sb.append(cst.toHuman()); return sb.toString(); }
/** {@inheritDoc} */ @Override protected void place0(Section addedTo, int offset) { // Encode the data and note the size. ByteArrayAnnotatedOutput out = new ByteArrayAnnotatedOutput(); ValueEncoder encoder = new ValueEncoder(addedTo.getFile(), out); encoder.writeAnnotation(annotation, false); encodedForm = out.toByteArray(); // Add one for the visibility byte in front of the encoded annotation. setWriteSize(encodedForm.length + 1); }
int type = constantToValueType(cst); int arg; case VALUE_LONG: { long value = ((CstLiteralBits) cst).getLongBits(); writeSignedIntegralValue(type, value); break; writeUnsignedIntegralValue(type, value); break; writeRightZeroExtendedValue(type, value); break; writeRightZeroExtendedValue(type, value); break; writeUnsignedIntegralValue(type, (long) index); break; writeUnsignedIntegralValue(type, (long) index); break; writeUnsignedIntegralValue(type, (long) index); break; writeUnsignedIntegralValue(type, (long) index); break;
if (annotates) { out.annotate(" [" + Integer.toHexString(i) + "] " + constantToHuman(cst)); writeConstant(cst);
int type = constantToValueType(cst); writeArray((CstArray) cst, false); break; writeAnnotation(((CstAnnotation) cst).getAnnotation(), false); break;
/** * Write a (listing file) annotation for this instance to the given * output, that consumes no bytes of output. This is for annotating * a reference to this instance at the point of the reference. * * @param out {@code non-null;} where to output to * @param prefix {@code non-null;} prefix for each line of output */ public void annotateTo(AnnotatedOutput out, String prefix) { out.annotate(0, prefix + "visibility: " + annotation.getVisibility().toHuman()); out.annotate(0, prefix + "type: " + annotation.getType().toHuman()); for (NameValuePair pair : annotation.getNameValuePairs()) { CstString name = pair.getName(); Constant value = pair.getValue(); out.annotate(0, prefix + name.toHuman() + ": " + ValueEncoder.constantToHuman(value)); } }
int type = constantToValueType(cst); int arg; case VALUE_LONG: { long value = ((CstLiteralBits) cst).getLongBits(); writeSignedIntegralValue(type, value); break; writeUnsignedIntegralValue(type, value); break; writeRightZeroExtendedValue(type, value); break; writeRightZeroExtendedValue(type, value); break; writeUnsignedIntegralValue(type, (long) index); break; writeUnsignedIntegralValue(type, (long) index); break; writeUnsignedIntegralValue(type, (long) index); break; writeUnsignedIntegralValue(type, (long) index); break;
/** {@inheritDoc} */ @Override protected void place0(Section addedTo, int offset) { // Encode the data and note the size. ByteArrayAnnotatedOutput out = new ByteArrayAnnotatedOutput(); ValueEncoder encoder = new ValueEncoder(addedTo.getFile(), out); encoder.writeAnnotation(annotation, false); encodedForm = out.toByteArray(); // Add one for the visibility byte in front of the encoded annotation. setWriteSize(encodedForm.length + 1); }
if (annotates) { out.annotate(" [" + Integer.toHexString(i) + "] " + constantToHuman(cst)); writeConstant(cst);
int type = constantToValueType(cst); int arg; writeArray((CstArray) cst, false); break; writeAnnotation(((CstAnnotation) cst).getAnnotation(), false); break;
/** * Write a (listing file) annotation for this instance to the given * output, that consumes no bytes of output. This is for annotating * a reference to this instance at the point of the reference. * * @param out {@code non-null;} where to output to * @param prefix {@code non-null;} prefix for each line of output */ public void annotateTo(AnnotatedOutput out, String prefix) { out.annotate(0, prefix + "visibility: " + annotation.getVisibility().toHuman()); out.annotate(0, prefix + "type: " + annotation.getType().toHuman()); for (NameValuePair pair : annotation.getNameValuePairs()) { CstString name = pair.getName(); Constant value = pair.getValue(); out.annotate(0, prefix + name.toHuman() + ": " + ValueEncoder.constantToHuman(value)); } }
int type = constantToValueType(cst); int arg; case VALUE_LONG: { long value = ((CstLiteralBits) cst).getLongBits(); writeSignedIntegralValue(type, value); break; writeUnsignedIntegralValue(type, value); break; writeRightZeroExtendedValue(type, value); break; writeRightZeroExtendedValue(type, value); break; writeUnsignedIntegralValue(type, (long) index); break; writeUnsignedIntegralValue(type, (long) index); break; writeUnsignedIntegralValue(type, (long) index); break; writeUnsignedIntegralValue(type, (long) index); break;
/** {@inheritDoc} */ @Override protected void place0(Section addedTo, int offset) { // Encode the data and note the size. ByteArrayAnnotatedOutput out = new ByteArrayAnnotatedOutput(); ValueEncoder encoder = new ValueEncoder(addedTo.getFile(), out); encoder.writeArray(value, true); encodedForm = out.toByteArray(); setWriteSize(encodedForm.length); }
/** {@inheritDoc} */ @Override protected void place0(Section addedTo, int offset) { // Encode the data and note the size. ByteArrayAnnotatedOutput out = new ByteArrayAnnotatedOutput(); ValueEncoder encoder = new ValueEncoder(addedTo.getFile(), out); encoder.writeAnnotation(annotation, false); encodedForm = out.toByteArray(); // Add one for the visibility byte in front of the encoded annotation. setWriteSize(encodedForm.length + 1); }
if (annotates) { out.annotate(" [" + Integer.toHexString(i) + "] " + constantToHuman(cst)); writeConstant(cst);
int type = constantToValueType(cst); int arg; writeArray((CstArray) cst, false); break; writeAnnotation(((CstAnnotation) cst).getAnnotation(), false); break;
/** {@inheritDoc} */ @Override public void addContents(DexFile file) { ValueEncoder.addContents(file, array); }
/** * Gets the colloquial type name and human form of the type of the * given constant, when used as an encoded value. * * @param cst {@code non-null;} the constant * @return {@code non-null;} its type name and human form */ public static String constantToHuman(Constant cst) { int type = constantToValueType(cst); if (type == VALUE_NULL) { return "null"; } StringBuilder sb = new StringBuilder(); sb.append(cst.typeName()); sb.append(' '); sb.append(cst.toHuman()); return sb.toString(); }