com.android.dex
Class EncodedValueReader

java.lang.Object
  extended by com.android.dex.EncodedValueReader

public final class EncodedValueReader
extends Object

Pull parser for encoded values.


Field Summary
static int ENCODED_ANNOTATION
           
static int ENCODED_ARRAY
           
static int ENCODED_BOOLEAN
           
static int ENCODED_BYTE
           
static int ENCODED_CHAR
           
static int ENCODED_DOUBLE
           
static int ENCODED_ENUM
           
static int ENCODED_FIELD
           
static int ENCODED_FLOAT
           
static int ENCODED_INT
           
static int ENCODED_LONG
           
static int ENCODED_METHOD
           
static int ENCODED_NULL
           
static int ENCODED_SHORT
           
static int ENCODED_STRING
           
static int ENCODED_TYPE
           
protected  ByteInput in
           
 
Constructor Summary
EncodedValueReader(ByteInput in)
           
EncodedValueReader(ByteInput in, int knownType)
          Creates a new encoded value reader whose only value is the specified known type.
EncodedValueReader(EncodedValue in)
           
EncodedValueReader(EncodedValue in, int knownType)
           
 
Method Summary
 int getAnnotationType()
          Returns the type of the annotation just returned by readAnnotation().
 int peek()
          Returns the type of the next value to read.
 int readAnnotation()
          Begins reading the fields of an annotation, returning the number of fields.
 int readAnnotationName()
           
 int readArray()
          Begins reading the elements of an array, returning the array's size.
 boolean readBoolean()
           
 byte readByte()
           
 char readChar()
           
 double readDouble()
           
 int readEnum()
           
 int readField()
           
 float readFloat()
           
 int readInt()
           
 long readLong()
           
 int readMethod()
           
 void readNull()
           
 short readShort()
           
 int readString()
           
 int readType()
           
 void skipValue()
          Skips a single value, including its nested values if it is an array or annotation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 to readAnnotationName() 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 by readAnnotation(). This method's value is undefined unless the most recent call was to readAnnotation().


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.



Copyright © 2015. All rights reserved.