Package com.android.dex
Class EncodedValueReader
- java.lang.Object
-
- com.android.dex.EncodedValueReader
-
public final class EncodedValueReader extends Object
Pull parser for encoded values.
-
-
Field Summary
Fields Modifier and Type Field Description static intENCODED_ANNOTATIONstatic intENCODED_ARRAYstatic intENCODED_BOOLEANstatic intENCODED_BYTEstatic intENCODED_CHARstatic intENCODED_DOUBLEstatic intENCODED_ENUMstatic intENCODED_FIELDstatic intENCODED_FLOATstatic intENCODED_INTstatic intENCODED_LONGstatic intENCODED_METHODstatic intENCODED_NULLstatic intENCODED_SHORTstatic intENCODED_STRINGstatic intENCODED_TYPEprotected ByteInputin
-
Constructor Summary
Constructors Constructor Description EncodedValueReader(EncodedValue in)EncodedValueReader(EncodedValue in, int knownType)EncodedValueReader(ByteInput in)EncodedValueReader(ByteInput in, int knownType)Creates a new encoded value reader whose only value is the specified known type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetAnnotationType()Returns the type of the annotation just returned byreadAnnotation().intpeek()Returns the type of the next value to read.intreadAnnotation()Begins reading the fields of an annotation, returning the number of fields.intreadAnnotationName()intreadArray()Begins reading the elements of an array, returning the array's size.booleanreadBoolean()bytereadByte()charreadChar()doublereadDouble()intreadEnum()intreadField()floatreadFloat()intreadInt()longreadLong()intreadMethod()voidreadNull()shortreadShort()intreadString()intreadType()voidskipValue()Skips a single value, including its nested values if it is an array or annotation.
-
-
-
Field Detail
-
ENCODED_BYTE
public static final int ENCODED_BYTE
- See Also:
- Constant Field Values
-
ENCODED_SHORT
public static final int ENCODED_SHORT
- See Also:
- Constant Field Values
-
ENCODED_CHAR
public static final int ENCODED_CHAR
- See Also:
- Constant Field Values
-
ENCODED_INT
public static final int ENCODED_INT
- See Also:
- Constant Field Values
-
ENCODED_LONG
public static final int ENCODED_LONG
- See Also:
- Constant Field Values
-
ENCODED_FLOAT
public static final int ENCODED_FLOAT
- See Also:
- Constant Field Values
-
ENCODED_DOUBLE
public static final int ENCODED_DOUBLE
- See Also:
- Constant Field Values
-
ENCODED_STRING
public static final int ENCODED_STRING
- See Also:
- Constant Field Values
-
ENCODED_TYPE
public static final int ENCODED_TYPE
- See Also:
- Constant Field Values
-
ENCODED_FIELD
public static final int ENCODED_FIELD
- See Also:
- Constant Field Values
-
ENCODED_ENUM
public static final int ENCODED_ENUM
- See Also:
- Constant Field Values
-
ENCODED_METHOD
public static final int ENCODED_METHOD
- See Also:
- Constant Field Values
-
ENCODED_ARRAY
public static final int ENCODED_ARRAY
- See Also:
- Constant Field Values
-
ENCODED_ANNOTATION
public static final int ENCODED_ANNOTATION
- See Also:
- Constant Field Values
-
ENCODED_NULL
public static final int ENCODED_NULL
- See Also:
- Constant Field Values
-
ENCODED_BOOLEAN
public static final int ENCODED_BOOLEAN
- See Also:
- Constant Field Values
-
in
protected final ByteInput in
-
-
Constructor Detail
-
EncodedValueReader
public EncodedValueReader(ByteInput in)
-
EncodedValueReader
public EncodedValueReader(EncodedValue in)
-
EncodedValueReader
public EncodedValueReader(ByteInput in, int knownType)
Creates a new encoded value reader whose only value is the specified known type. This is useful for encoded values without a type prefix, such as class_def_item's encoded_array or annotation_item's encoded_annotation.
-
EncodedValueReader
public EncodedValueReader(EncodedValue in, int knownType)
-
-
Method Detail
-
peek
public int peek()
Returns the type of the next value to read.
-
readArray
public int readArray()
Begins reading the elements of an array, returning the array's size. The caller must follow up by calling a read method for each element in the array. For example, this reads a byte array:int arraySize = readArray(); for (int i = 0, i < arraySize; i++) { readByte(); }
-
readAnnotation
public int readAnnotation()
Begins reading the fields of an annotation, returning the number of fields. The caller must follow up by making alternating calls toreadAnnotationName()and another read method. For example, this reads an annotation whose fields are all bytes:int fieldCount = readAnnotation(); int annotationType = getAnnotationType(); for (int i = 0; i < fieldCount; i++) { readAnnotationName(); readByte(); }
-
getAnnotationType
public int getAnnotationType()
Returns the type of the annotation just returned byreadAnnotation(). This method's value is undefined unless the most recent call was toreadAnnotation().
-
readAnnotationName
public int readAnnotationName()
-
readByte
public byte readByte()
-
readShort
public short readShort()
-
readChar
public char readChar()
-
readInt
public int readInt()
-
readLong
public long readLong()
-
readFloat
public float readFloat()
-
readDouble
public double readDouble()
-
readString
public int readString()
-
readType
public int readType()
-
readField
public int readField()
-
readEnum
public int readEnum()
-
readMethod
public int readMethod()
-
readNull
public void readNull()
-
readBoolean
public boolean readBoolean()
-
skipValue
public void skipValue()
Skips a single value, including its nested values if it is an array or annotation.
-
-