Search in sources :

Example 11 with ByteArrayAnnotatedOutput

use of com.android.dx.util.ByteArrayAnnotatedOutput in project buck by facebook.

the class IndexMap method adjustEncodedArray.

public EncodedValue adjustEncodedArray(EncodedValue encodedArray) {
    ByteArrayAnnotatedOutput out = new ByteArrayAnnotatedOutput(32);
    new EncodedValueTransformer(out).transformArray(new EncodedValueReader(encodedArray, ENCODED_ARRAY));
    return new EncodedValue(out.toByteArray());
}
Also used : EncodedValue(com.android.dex.EncodedValue) EncodedValueReader(com.android.dex.EncodedValueReader) ByteArrayAnnotatedOutput(com.android.dx.util.ByteArrayAnnotatedOutput)

Example 12 with ByteArrayAnnotatedOutput

use of com.android.dx.util.ByteArrayAnnotatedOutput in project buck by facebook.

the class DexFile method toDex.

/**
     * Returns the contents of this instance as a {@code .dex} file,
     * in {@code byte[]} form.
     *
     * @param humanOut {@code null-ok;} where to write human-oriented output to
     * @param verbose whether to be verbose when writing human-oriented output
     * @return {@code non-null;} a {@code .dex} file for this instance
     */
public byte[] toDex(Writer humanOut, boolean verbose) throws IOException {
    boolean annotate = (humanOut != null);
    ByteArrayAnnotatedOutput result = toDex0(annotate, verbose);
    if (annotate) {
        result.writeAnnotationsTo(humanOut);
    }
    return result.getArray();
}
Also used : ByteArrayAnnotatedOutput(com.android.dx.util.ByteArrayAnnotatedOutput)

Example 13 with ByteArrayAnnotatedOutput

use of com.android.dx.util.ByteArrayAnnotatedOutput in project buck by facebook.

the class AnnotationItem method place0.

/** {@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);
}
Also used : ByteArrayAnnotatedOutput(com.android.dx.util.ByteArrayAnnotatedOutput)

Example 14 with ByteArrayAnnotatedOutput

use of com.android.dx.util.ByteArrayAnnotatedOutput in project buck by facebook.

the class EncodedArrayItem method place0.

/** {@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);
}
Also used : ByteArrayAnnotatedOutput(com.android.dx.util.ByteArrayAnnotatedOutput)

Example 15 with ByteArrayAnnotatedOutput

use of com.android.dx.util.ByteArrayAnnotatedOutput in project J2ME-Loader by nikita36078.

the class AnnotationItem method place0.

/**
 * {@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);
}
Also used : ByteArrayAnnotatedOutput(com.android.dx.util.ByteArrayAnnotatedOutput)

Aggregations

ByteArrayAnnotatedOutput (com.android.dx.util.ByteArrayAnnotatedOutput)20 EncodedValue (com.android.dex.EncodedValue)6 EncodedValueReader (com.android.dex.EncodedValueReader)4 Annotation (com.android.dex.Annotation)2 ExceptionWithContext (com.android.dex.util.ExceptionWithContext)2 CatchHandlerList (com.android.dx.dex.code.CatchHandlerList)2 Map (java.util.Map)2 TreeMap (java.util.TreeMap)2