org.jf.dexlib2.iface.value.ArrayEncodedValue Java Examples

The following examples show how to use org.jf.dexlib2.iface.value.ArrayEncodedValue. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArrayEncodedValueAdaptor.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
public static void writeTo(IndentingWriter writer, ArrayEncodedValue arrayEncodedValue) throws IOException {
    writer.write('{');
    Collection<? extends EncodedValue> values = arrayEncodedValue.getValue();
    if (values.size() == 0) {
        writer.write('}');
        return;
    }

    writer.write('\n');
    writer.indent(4);
    boolean first = true;
    for (EncodedValue encodedValue: values) {
        if (!first) {
            writer.write(",\n");
        }
        first = false;

        EncodedValueAdaptor.writeTo(writer, encodedValue);
    }
    writer.deindent(4);
    writer.write("\n}");
}
 
Example #2
Source File: ArrayEncodedValueAdaptor.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
public static void writeTo(IndentingWriter writer, ArrayEncodedValue arrayEncodedValue) throws IOException {
    writer.write('{');
    Collection<? extends EncodedValue> values = arrayEncodedValue.getValue();
    if (values.size() == 0) {
        writer.write('}');
        return;
    }

    writer.write('\n');
    writer.indent(4);
    boolean first = true;
    for (EncodedValue encodedValue: values) {
        if (!first) {
            writer.write(",\n");
        }
        first = false;

        EncodedValueAdaptor.writeTo(writer, encodedValue);
    }
    writer.deindent(4);
    writer.write("\n}");
}
 
Example #3
Source File: ArrayEncodedValueAdaptor.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
public static void writeTo(IndentingWriter writer, ArrayEncodedValue arrayEncodedValue) throws IOException {
    writer.write('{');
    Collection<? extends EncodedValue> values = arrayEncodedValue.getValue();
    if (values.size() == 0) {
        writer.write('}');
        return;
    }

    writer.write('\n');
    writer.indent(4);
    boolean first = true;
    for (EncodedValue encodedValue: values) {
        if (!first) {
            writer.write(",\n");
        }
        first = false;

        EncodedValueAdaptor.writeTo(writer, encodedValue);
    }
    writer.deindent(4);
    writer.write("\n}");
}
 
Example #4
Source File: ArrayEncodedValueAdaptor.java    From atlas with Apache License 2.0 6 votes vote down vote up
public static void writeTo(@Nonnull IndentingWriter writer,
                           @Nonnull ArrayEncodedValue arrayEncodedValue,
                           @Nullable String containingClass) throws IOException {
    writer.write('{');
    Collection<? extends EncodedValue> values = arrayEncodedValue.getValue();
    if (values.size() == 0) {
        writer.write('}');
        return;
    }

    writer.write('\n');
    writer.indent(4);
    boolean first = true;
    for (EncodedValue encodedValue: values) {
        if (!first) {
            writer.write(",\n");
        }
        first = false;

        EncodedValueAdaptor.writeTo(writer, encodedValue, containingClass);
    }
    writer.deindent(4);
    writer.write("\n}");
}
 
Example #5
Source File: ArrayEncodedValueAdaptor.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
public static void writeTo(IndentingWriter writer, ArrayEncodedValue arrayEncodedValue) throws IOException {
    writer.write('{');
    Collection<? extends EncodedValue> values = arrayEncodedValue.getValue();
    if (values.size() == 0) {
        writer.write('}');
        return;
    }

    writer.write('\n');
    writer.indent(4);
    boolean first = true;
    for (EncodedValue encodedValue: values) {
        if (!first) {
            writer.write(",\n");
        }
        first = false;

        EncodedValueAdaptor.writeTo(writer, encodedValue);
    }
    writer.deindent(4);
    writer.write("\n}");
}
 
Example #6
Source File: BaseArrayEncodedValue.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(@Nullable Object o) {
    if (o instanceof ArrayEncodedValue) {
        return getValue().equals(((ArrayEncodedValue)o).getValue());
    }
    return false;
}
 
Example #7
Source File: BaseArrayEncodedValue.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(@Nullable Object o) {
    if (o instanceof ArrayEncodedValue) {
        return getValue().equals(((ArrayEncodedValue)o).getValue());
    }
    return false;
}
 
Example #8
Source File: BaseArrayEncodedValue.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(@Nullable Object o) {
    if (o instanceof ArrayEncodedValue) {
        return getValue().equals(((ArrayEncodedValue)o).getValue());
    }
    return false;
}
 
Example #9
Source File: BaseArrayEncodedValue.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(@Nullable Object o) {
    if (o instanceof ArrayEncodedValue) {
        return getValue().equals(((ArrayEncodedValue)o).getValue());
    }
    return false;
}
 
Example #10
Source File: EncodedValueAdaptor.java    From atlas with Apache License 2.0 4 votes vote down vote up
public static void writeTo(@Nonnull IndentingWriter writer, @Nonnull EncodedValue encodedValue,
                           @Nullable String containingClass)
        throws IOException {
    switch (encodedValue.getValueType()) {
        case ValueType.ANNOTATION:
            AnnotationEncodedValueAdaptor.writeTo(writer, (AnnotationEncodedValue) encodedValue, containingClass);
            return;
        case ValueType.ARRAY:
            ArrayEncodedValueAdaptor.writeTo(writer, (ArrayEncodedValue)encodedValue, containingClass);
            return;
        case ValueType.BOOLEAN:
            BooleanRenderer.writeTo(writer, ((BooleanEncodedValue) encodedValue).getValue());
            return;
        case ValueType.BYTE:
            ByteRenderer.writeTo(writer, ((ByteEncodedValue) encodedValue).getValue());
            return;
        case ValueType.CHAR:
            CharRenderer.writeTo(writer, ((CharEncodedValue) encodedValue).getValue());
            return;
        case ValueType.DOUBLE:
            DoubleRenderer.writeTo(writer, ((DoubleEncodedValue) encodedValue).getValue());
            return;
        case ValueType.ENUM:
            EnumEncodedValue enumEncodedValue = (EnumEncodedValue)encodedValue;
            boolean useImplicitReference = false;
            if (enumEncodedValue.getValue().getDefiningClass().equals(containingClass)) {
                useImplicitReference = true;
            }
            writer.write(".enum ");
            ReferenceUtil.writeFieldDescriptor(writer, enumEncodedValue.getValue(), useImplicitReference);
            return;
        case ValueType.FIELD:
            FieldEncodedValue fieldEncodedValue = (FieldEncodedValue)encodedValue;
            useImplicitReference = false;
            if (fieldEncodedValue.getValue().getDefiningClass().equals(containingClass)) {
                useImplicitReference = true;
            }
            ReferenceUtil.writeFieldDescriptor(writer, fieldEncodedValue.getValue(), useImplicitReference);
            return;
        case ValueType.FLOAT:
            FloatRenderer.writeTo(writer, ((FloatEncodedValue) encodedValue).getValue());
            return;
        case ValueType.INT:
            IntegerRenderer.writeTo(writer, ((IntEncodedValue) encodedValue).getValue());
            return;
        case ValueType.LONG:
            LongRenderer.writeTo(writer, ((LongEncodedValue) encodedValue).getValue());
            return;
        case ValueType.METHOD:
            MethodEncodedValue methodEncodedValue = (MethodEncodedValue)encodedValue;
            useImplicitReference = false;
            if (methodEncodedValue.getValue().getDefiningClass().equals(containingClass)) {
                useImplicitReference = true;
            }
            ReferenceUtil.writeMethodDescriptor(writer, methodEncodedValue.getValue(), useImplicitReference);
            return;
        case ValueType.NULL:
            writer.write("null");
            return;
        case ValueType.SHORT:
            ShortRenderer.writeTo(writer, ((ShortEncodedValue) encodedValue).getValue());
            return;
        case ValueType.STRING:
            ReferenceFormatter.writeStringReference(writer, ((StringEncodedValue) encodedValue).getValue());
            return;
        case ValueType.TYPE:
            writer.write(((TypeEncodedValue)encodedValue).getValue());
    }
}
 
Example #11
Source File: ImmutableArrayEncodedValue.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
public static ImmutableArrayEncodedValue of(@Nonnull ArrayEncodedValue arrayEncodedValue) {
    if (arrayEncodedValue instanceof ImmutableArrayEncodedValue) {
        return (ImmutableArrayEncodedValue)arrayEncodedValue;
    }
    return new ImmutableArrayEncodedValue(arrayEncodedValue.getValue());
}
 
Example #12
Source File: BaseArrayEncodedValue.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
@Override public int compareTo(@Nonnull EncodedValue o) {
    int res = Ints.compare(getValueType(), o.getValueType());
    if (res != 0) return res;
    return CollectionUtils.compareAsList(getValue(), ((ArrayEncodedValue)o).getValue());
}
 
Example #13
Source File: ImmutableArrayEncodedValue.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
public static ImmutableArrayEncodedValue of(@Nonnull ArrayEncodedValue arrayEncodedValue) {
    if (arrayEncodedValue instanceof ImmutableArrayEncodedValue) {
        return (ImmutableArrayEncodedValue)arrayEncodedValue;
    }
    return new ImmutableArrayEncodedValue(arrayEncodedValue.getValue());
}
 
Example #14
Source File: ImmutableArrayEncodedValue.java    From HeyGirl with Apache License 2.0 4 votes vote down vote up
public static ImmutableArrayEncodedValue of(@Nonnull ArrayEncodedValue arrayEncodedValue) {
    if (arrayEncodedValue instanceof ImmutableArrayEncodedValue) {
        return (ImmutableArrayEncodedValue)arrayEncodedValue;
    }
    return new ImmutableArrayEncodedValue(arrayEncodedValue.getValue());
}
 
Example #15
Source File: BaseArrayEncodedValue.java    From HeyGirl with Apache License 2.0 4 votes vote down vote up
@Override public int compareTo(@Nonnull EncodedValue o) {
    int res = Ints.compare(getValueType(), o.getValueType());
    if (res != 0) return res;
    return CollectionUtils.compareAsList(getValue(), ((ArrayEncodedValue)o).getValue());
}
 
Example #16
Source File: BaseArrayEncodedValue.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
@Override public int compareTo(@Nonnull EncodedValue o) {
    int res = Ints.compare(getValueType(), o.getValueType());
    if (res != 0) return res;
    return CollectionUtils.compareAsList(getValue(), ((ArrayEncodedValue)o).getValue());
}
 
Example #17
Source File: ImmutableArrayEncodedValue.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
public static ImmutableArrayEncodedValue of(@Nonnull ArrayEncodedValue arrayEncodedValue) {
    if (arrayEncodedValue instanceof ImmutableArrayEncodedValue) {
        return (ImmutableArrayEncodedValue)arrayEncodedValue;
    }
    return new ImmutableArrayEncodedValue(arrayEncodedValue.getValue());
}
 
Example #18
Source File: BaseArrayEncodedValue.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
@Override public int compareTo(@Nonnull EncodedValue o) {
    int res = Ints.compare(getValueType(), o.getValueType());
    if (res != 0) return res;
    return CollectionUtils.compareAsList(getValue(), ((ArrayEncodedValue)o).getValue());
}