Search in sources :

Example 1 with StringData

use of com.tencent.tinker.android.dex.StringData in project tinker by Tencent.

the class DexDataBuffer method readStringData.

public StringData readStringData() {
    int off = data.position();
    try {
        int expectedLength = readUleb128();
        String result = Mutf8.decode(this, new char[expectedLength]);
        if (result.length() != expectedLength) {
            throw new DexException("Declared length " + expectedLength + " doesn't match decoded length of " + result.length());
        }
        return new StringData(off, result);
    } catch (UTFDataFormatException e) {
        throw new DexException(e);
    }
}
Also used : DexException(com.tencent.tinker.android.dex.DexException) UTFDataFormatException(java.io.UTFDataFormatException) StringData(com.tencent.tinker.android.dex.StringData)

Aggregations

DexException (com.tencent.tinker.android.dex.DexException)1 StringData (com.tencent.tinker.android.dex.StringData)1 UTFDataFormatException (java.io.UTFDataFormatException)1