mirror of
https://github.com/revanced/smali.git
synced 2025-05-04 00:24:34 +02:00
Rename DexFile to DexFileBuffer
This commit is contained in:
parent
a88239d92d
commit
dc9e5455bc
@ -39,13 +39,13 @@ import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class DexBackedAnnotation implements Annotation {
|
||||
@Nonnull public final DexFile dexFile;
|
||||
@Nonnull public final DexFileBuffer dexFile;
|
||||
|
||||
public final int visibility;
|
||||
@Nonnull public final String type;
|
||||
private final int elementsOffset;
|
||||
|
||||
public DexBackedAnnotation(@Nonnull DexFile dexFile,
|
||||
public DexBackedAnnotation(@Nonnull DexFileBuffer dexFile,
|
||||
int annotationOffset) {
|
||||
this.dexFile = dexFile;
|
||||
|
||||
|
@ -41,7 +41,7 @@ import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class DexBackedClassDef implements ClassDef {
|
||||
@Nonnull public final DexFile dexFile;
|
||||
@Nonnull public final DexFileBuffer dexFile;
|
||||
|
||||
@Nonnull public final String name;
|
||||
public final int accessFlags;
|
||||
@ -63,7 +63,7 @@ public class DexBackedClassDef implements ClassDef {
|
||||
private static final int CLASS_DATA_OFFSET = 24;
|
||||
private static final int STATIC_INITIAL_VALUES_OFFSET = 28;
|
||||
|
||||
public DexBackedClassDef(@Nonnull DexFile dexFile,
|
||||
public DexBackedClassDef(@Nonnull DexFileBuffer dexFile,
|
||||
int classDefOffset) {
|
||||
this.dexFile = dexFile;
|
||||
|
||||
|
@ -41,7 +41,7 @@ import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class DexBackedField implements Field {
|
||||
@Nonnull public final DexFile dexFile;
|
||||
@Nonnull public final DexFileBuffer dexFile;
|
||||
|
||||
@Nonnull public final String name;
|
||||
@Nonnull public final String type;
|
||||
|
@ -44,7 +44,7 @@ import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class DexBackedMethod implements Method {
|
||||
@Nonnull public final DexFile dexFile;
|
||||
@Nonnull public final DexFileBuffer dexFile;
|
||||
|
||||
@Nonnull public final String name;
|
||||
public final int accessFlags;
|
||||
|
@ -45,7 +45,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DexBackedMethodImplementation implements MethodImplementation {
|
||||
@Nonnull public final DexFile dexFile;
|
||||
@Nonnull public final DexFileBuffer dexFile;
|
||||
private final int codeOffset;
|
||||
|
||||
public final int registerCount;
|
||||
@ -59,7 +59,7 @@ public class DexBackedMethodImplementation implements MethodImplementation {
|
||||
|
||||
private static final int TRY_ITEM_SIZE = 8;
|
||||
|
||||
public DexBackedMethodImplementation(@Nonnull DexFile dexFile,
|
||||
public DexBackedMethodImplementation(@Nonnull DexFileBuffer dexFile,
|
||||
int codeOffset) {
|
||||
this.dexFile = dexFile;
|
||||
this.codeOffset = codeOffset;
|
||||
|
@ -40,7 +40,7 @@ import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class DexBackedTryBlock implements TryBlock {
|
||||
public final DexFile dexFile;
|
||||
public final DexFileBuffer dexFile;
|
||||
private final InstructionOffsetMap instructionOffsetMap;
|
||||
|
||||
public final int startIndex;
|
||||
@ -52,7 +52,7 @@ public class DexBackedTryBlock implements TryBlock {
|
||||
private static final int CODE_UNIT_COUNT_OFFSET = 4;
|
||||
private static final int HANDLER_OFFSET_OFFSET = 6;
|
||||
|
||||
public DexBackedTryBlock(DexFile dexFile,
|
||||
public DexBackedTryBlock(DexFileBuffer dexFile,
|
||||
int tryItemOffset,
|
||||
int handlersStartOffset,
|
||||
InstructionOffsetMap instructionOffsetMap) {
|
||||
|
@ -35,11 +35,11 @@ import org.jf.util.ExceptionWithContext;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class DexFile {
|
||||
public class DexFileBuffer {
|
||||
// TODO: consider using a direct ByteBuffer instead
|
||||
protected final byte[] buf;
|
||||
|
||||
public DexFile(byte[] buf) {
|
||||
public DexFileBuffer(byte[] buf) {
|
||||
this.buf = buf;
|
||||
}
|
||||
|
@ -36,15 +36,15 @@ import org.jf.util.ExceptionWithContext;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class DexFileReader {
|
||||
@Nonnull private final DexFile dexFile;
|
||||
@Nonnull private final DexFileBuffer dexFile;
|
||||
private int offset;
|
||||
|
||||
public DexFileReader(@Nonnull DexFile dexFile, int offset) {
|
||||
public DexFileReader(@Nonnull DexFileBuffer dexFile, int offset) {
|
||||
this.dexFile = dexFile;
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
@Nonnull public DexFile getDexFile() { return dexFile; }
|
||||
@Nonnull public DexFileBuffer getDexFile() { return dexFile; }
|
||||
public int getOffset() { return offset; }
|
||||
|
||||
public String getString(int stringIndex) { return dexFile.getString(stringIndex); }
|
||||
|
@ -32,7 +32,7 @@
|
||||
package org.jf.dexlib2.dexbacked.util;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.jf.dexlib2.dexbacked.DexFile;
|
||||
import org.jf.dexlib2.dexbacked.DexFileBuffer;
|
||||
import org.jf.dexlib2.dexbacked.DexBackedAnnotation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@ -53,7 +53,7 @@ public abstract class AnnotationsDirectory {
|
||||
@Nonnull public abstract AnnotationIterator getMethodAnnotationIterator();
|
||||
@Nonnull public abstract AnnotationIterator getParameterAnnotationIterator();
|
||||
|
||||
public static AnnotationsDirectory newOrEmpty(@Nonnull DexFile dexFile,
|
||||
public static AnnotationsDirectory newOrEmpty(@Nonnull DexFileBuffer dexFile,
|
||||
int directoryAnnotationsOffset) {
|
||||
if (directoryAnnotationsOffset == 0) {
|
||||
return EMPTY;
|
||||
@ -71,7 +71,7 @@ public abstract class AnnotationsDirectory {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static List<? extends DexBackedAnnotation> getAnnotations(@Nonnull final DexFile dexFile,
|
||||
public static List<? extends DexBackedAnnotation> getAnnotations(@Nonnull final DexFileBuffer dexFile,
|
||||
final int annotationSetOffset) {
|
||||
if (annotationSetOffset != 0) {
|
||||
final int size = dexFile.readSmallUint(annotationSetOffset);
|
||||
@ -89,7 +89,7 @@ public abstract class AnnotationsDirectory {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
public static List<List<? extends DexBackedAnnotation>> getParameterAnnotations(@Nonnull final DexFile dexFile,
|
||||
public static List<List<? extends DexBackedAnnotation>> getParameterAnnotations(@Nonnull final DexFileBuffer dexFile,
|
||||
final int annotationSetListOffset) {
|
||||
if (annotationSetListOffset > 0) {
|
||||
final int size = dexFile.readSmallUint(annotationSetListOffset);
|
||||
@ -108,7 +108,7 @@ public abstract class AnnotationsDirectory {
|
||||
}
|
||||
|
||||
private static class AnnotationsDirectoryImpl extends AnnotationsDirectory {
|
||||
@Nonnull public final DexFile dexFile;
|
||||
@Nonnull public final DexFileBuffer dexFile;
|
||||
private final int directoryOffset;
|
||||
|
||||
private static final int FIELD_COUNT_OFFSET = 4;
|
||||
@ -121,7 +121,7 @@ public abstract class AnnotationsDirectory {
|
||||
/** The size of a method_annotation structure */
|
||||
private static final int METHOD_ANNOTATION_SIZE = 8;
|
||||
|
||||
public AnnotationsDirectoryImpl(@Nonnull DexFile dexFile,
|
||||
public AnnotationsDirectoryImpl(@Nonnull DexFileBuffer dexFile,
|
||||
int directoryOffset) {
|
||||
this.dexFile = dexFile;
|
||||
this.directoryOffset = directoryOffset;
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
package org.jf.dexlib2.dexbacked.util;
|
||||
|
||||
import org.jf.dexlib2.dexbacked.DexFile;
|
||||
import org.jf.dexlib2.dexbacked.DexFileBuffer;
|
||||
import org.jf.dexlib2.dexbacked.DexFileReader;
|
||||
import org.jf.dexlib2.dexbacked.value.DexBackedEncodedValue;
|
||||
import org.jf.dexlib2.iface.value.EncodedValue;
|
||||
@ -49,7 +49,7 @@ public abstract class StaticInitialValueIterator {
|
||||
public abstract void skipNext();
|
||||
|
||||
@Nonnull
|
||||
public static StaticInitialValueIterator newOrEmpty(@Nonnull DexFile dexFile, int offset) {
|
||||
public static StaticInitialValueIterator newOrEmpty(@Nonnull DexFileBuffer dexFile, int offset) {
|
||||
if (offset == 0) {
|
||||
return EMPTY;
|
||||
}
|
||||
@ -61,7 +61,7 @@ public abstract class StaticInitialValueIterator {
|
||||
private final int size;
|
||||
private int index = 0;
|
||||
|
||||
public StaticInitialValueIteratorImpl(@Nonnull DexFile dexFile, int offset) {
|
||||
public StaticInitialValueIteratorImpl(@Nonnull DexFileBuffer dexFile, int offset) {
|
||||
this.reader = dexFile.readerAt(offset);
|
||||
this.size = reader.readSmallUleb128();
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
package org.jf.dexlib2.dexbacked.util;
|
||||
|
||||
import org.jf.dexlib2.dexbacked.DexFile;
|
||||
import org.jf.dexlib2.dexbacked.DexFileBuffer;
|
||||
import org.jf.dexlib2.dexbacked.DexFileReader;
|
||||
import org.jf.util.AbstractListIterator;
|
||||
|
||||
@ -44,10 +44,10 @@ import java.util.NoSuchElementException;
|
||||
* @param <T> The type of the item that this list contains
|
||||
*/
|
||||
public abstract class VariableSizeList<T> extends AbstractSequentialList<T> {
|
||||
@Nonnull private final DexFile dexFile;
|
||||
@Nonnull private final DexFileBuffer dexFile;
|
||||
private final int offset;
|
||||
|
||||
public VariableSizeList(@Nonnull DexFile dexFile, int offset) {
|
||||
public VariableSizeList(@Nonnull DexFileBuffer dexFile, int offset) {
|
||||
this.dexFile = dexFile;
|
||||
this.offset = offset;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
package org.jf.dexlib2.dexbacked.util;
|
||||
|
||||
import org.jf.dexlib2.dexbacked.DexFile;
|
||||
import org.jf.dexlib2.dexbacked.DexFileBuffer;
|
||||
import org.jf.dexlib2.dexbacked.DexFileReader;
|
||||
import org.jf.util.AbstractListIterator;
|
||||
|
||||
@ -68,7 +68,7 @@ public abstract class VariableSizeListWithContext<T> extends AbstractSequentialL
|
||||
private int index = 0;
|
||||
@Nonnull private final DexFileReader reader;
|
||||
|
||||
public Iterator(DexFile dexFile, int offset) {
|
||||
public Iterator(DexFileBuffer dexFile, int offset) {
|
||||
this.reader = dexFile.readerAt(offset);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
package org.jf.dexlib2.dexbacked.value;
|
||||
|
||||
import org.jf.dexlib2.dexbacked.DexFile;
|
||||
import org.jf.dexlib2.dexbacked.DexFileBuffer;
|
||||
import org.jf.dexlib2.dexbacked.DexFileReader;
|
||||
import org.jf.dexlib2.ValueType;
|
||||
import org.jf.dexlib2.dexbacked.DexBackedAnnotationElement;
|
||||
@ -43,7 +43,7 @@ import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class DexBackedAnnotationEncodedValue implements AnnotationEncodedValue {
|
||||
@Nonnull public final DexFile dexFile;
|
||||
@Nonnull public final DexFileBuffer dexFile;
|
||||
public final String type;
|
||||
private final int elementsOffset;
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
package org.jf.dexlib2.dexbacked.value;
|
||||
|
||||
import org.jf.dexlib2.dexbacked.DexFile;
|
||||
import org.jf.dexlib2.dexbacked.DexFileBuffer;
|
||||
import org.jf.dexlib2.dexbacked.DexFileReader;
|
||||
import org.jf.dexlib2.ValueType;
|
||||
import org.jf.dexlib2.dexbacked.util.VariableSizeList;
|
||||
@ -42,7 +42,7 @@ import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class DexBackedArrayEncodedValue implements ArrayEncodedValue {
|
||||
@Nonnull public final DexFile dexFile;
|
||||
@Nonnull public final DexFileBuffer dexFile;
|
||||
private final int encodedArrayOffset;
|
||||
|
||||
public DexBackedArrayEncodedValue(@Nonnull DexFileReader dexFileReader) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user