Package com.android.dx.rop.cst

Examples of com.android.dx.rop.cst.CstUtf8


    /** {@inheritDoc} */
    @Override
    public void writeTo(DexFile file, AnnotatedOutput out) {
        CstType type = getDefiningClass();
        CstUtf8 descriptor = type.getDescriptor();
        int idx = file.getStringIds().indexOf(descriptor);

        if (out.annotates()) {
            out.annotate(0, indexString() + ' ' + descriptor.toHuman());
            out.annotate(4, "  descriptor_idx: " + Hex.u4(idx));
        }

        out.writeInt(idx);
    }
View Full Code Here


        int dataOff = firstDataSection.getFileOffset();
        int dataSize = lastDataSection.getFileOffset() +
            lastDataSection.writeSize() - dataOff;
       
        if (out.annotates()) {
            out.annotate(8, "magic: " + new CstUtf8(MAGIC).toQuoted());
            out.annotate(4, "checksum");
            out.annotate(20, "signature");
            out.annotate(4, "file_size:       " +
                         Hex.u4(file.getFileSize()));
            out.annotate(4, "header_size:     " + Hex.u4(HEADER_SIZE));
View Full Code Here

                    cst = CstDouble.make(bits);
                    break;
                }
                case CONSTANT_Class: {
                    int nameIndex = bytes.getUnsignedShort(at + 1);
                    CstUtf8 name = (CstUtf8) parse0(nameIndex);
                    cst = new CstType(Type.internClassName(name.getString()));
                    break;
                }
                case CONSTANT_String: {
                    int stringIndex = bytes.getUnsignedShort(at + 1);
                    CstUtf8 string = (CstUtf8) parse0(stringIndex);
                    cst = new CstString(string);
                    break;
                }
                case CONSTANT_Fieldref: {
                    int classIndex = bytes.getUnsignedShort(at + 1);
                    CstType type = (CstType) parse0(classIndex);
                    int natIndex = bytes.getUnsignedShort(at + 3);
                    CstNat nat = (CstNat) parse0(natIndex);
                    cst = new CstFieldRef(type, nat);
                    break;
                }
                case CONSTANT_Methodref: {
                    int classIndex = bytes.getUnsignedShort(at + 1);
                    CstType type = (CstType) parse0(classIndex);
                    int natIndex = bytes.getUnsignedShort(at + 3);
                    CstNat nat = (CstNat) parse0(natIndex);
                    cst = new CstMethodRef(type, nat);
                    break;
                }
                case CONSTANT_InterfaceMethodref: {
                    int classIndex = bytes.getUnsignedShort(at + 1);
                    CstType type = (CstType) parse0(classIndex);
                    int natIndex = bytes.getUnsignedShort(at + 3);
                    CstNat nat = (CstNat) parse0(natIndex);
                    cst = new CstInterfaceMethodRef(type, nat);
                    break;
                }
                case CONSTANT_NameAndType: {
                    int nameIndex = bytes.getUnsignedShort(at + 1);
                    CstUtf8 name = (CstUtf8) parse0(nameIndex);
                    int descriptorIndex = bytes.getUnsignedShort(at + 3);
                    CstUtf8 descriptor = (CstUtf8) parse0(descriptorIndex);
                    cst = new CstNat(name, descriptor);
                    break;
                }
            }
        } catch (ParseException ex) {
View Full Code Here

        at += 3; // Skip to the data.

        ByteArray ubytes = bytes.slice(at, at + length);

        try {
            return new CstUtf8(ubytes);
        } catch (IllegalArgumentException ex) {
            // Translate the exception
            throw new ParseException(ex);
        }
    }
View Full Code Here

            int outerClassIdx = bytes.getUnsignedShort(offset + 2);
            int nameIdx = bytes.getUnsignedShort(offset + 4);
            int accessFlags = bytes.getUnsignedShort(offset + 6);
            CstType innerClass = (CstType) pool.get(innerClassIdx);
            CstType outerClass = (CstType) pool.get0Ok(outerClassIdx);
            CstUtf8 name = (CstUtf8) pool.get0Ok(nameIdx);
            list.set(i, innerClass, outerClass, name, accessFlags);
            if (observer != null) {
                observer.parsed(bytes, offset, 2,
                                "inner_class: " +
                                DirectClassFile.stringOrNone(innerClass));
View Full Code Here

                int startPc = in.readUnsignedShort();
                int length = in.readUnsignedShort();
                int nameIdx = in.readUnsignedShort();
                int typeIdx = in.readUnsignedShort();
                int index = in.readUnsignedShort();
                CstUtf8 name = (CstUtf8) pool.get(nameIdx);
                CstUtf8 type = (CstUtf8) pool.get(typeIdx);
                CstUtf8 descriptor = null;
                CstUtf8 signature = null;
               
                if (typeTable) {
                    signature = type;
                } else {
                    descriptor = type;
View Full Code Here

        }

        ByteArray bytes = cf.getBytes();
        ConstantPool pool = cf.getConstantPool();
        int idx = bytes.getUnsignedShort(offset);
        CstUtf8 cst = (CstUtf8) pool.get(idx);
        Attribute result = new AttSignature(cst);

        if (observer != null) {
            observer.parsed(bytes, offset, 2, "signature: " + cst);
        }
View Full Code Here

        }

        ByteArray bytes = cf.getBytes();
        ConstantPool pool = cf.getConstantPool();
        int idx = bytes.getUnsignedShort(offset);
        CstUtf8 cst = (CstUtf8) pool.get(idx);
        Attribute result = new AttSourceFile(cst);

        if (observer != null) {
            observer.parsed(bytes, offset, 2, "source: " + cst);
        }
View Full Code Here

            throws IOException {
        requireLength(4);

        int typeIndex = input.readUnsignedShort();
        int numElements = input.readUnsignedShort();
        CstUtf8 typeUtf8 = (CstUtf8) pool.get(typeIndex);
        CstType type = new CstType(Type.intern(typeUtf8.getString()));

        if (observer != null) {
            parsed(2, "type: " + type.toHuman());
            parsed(2, "num_elements: " + numElements);
        }
View Full Code Here

     */
    private NameValuePair parseElement() throws IOException {
        requireLength(5);
               
        int elementNameIndex = input.readUnsignedShort();
        CstUtf8 elementName = (CstUtf8) pool.get(elementNameIndex);
               
        if (observer != null) {
            parsed(2, "element_name: " + elementName.toHuman());
            parsed(0, "value: ");
            changeIndent(1);
        }

        Constant value = parseValue();
View Full Code Here

TOP

Related Classes of com.android.dx.rop.cst.CstUtf8

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.