Class EncodedValueReader


  • public final class EncodedValueReader
    extends Object
    Pull parser for encoded values.
    • 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.