Java Code Examples for com.android.dex.Leb128#writeUnsignedLeb128()

The following examples show how to use com.android.dex.Leb128#writeUnsignedLeb128() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IndexMap.java    From Box with Apache License 2.0 5 votes vote down vote up
private void transformAnnotation(EncodedValueReader reader) {
    int fieldCount = reader.readAnnotation();
    Leb128.writeUnsignedLeb128(out, adjustType(reader.getAnnotationType()));
    Leb128.writeUnsignedLeb128(out, fieldCount);
    for (int i = 0; i < fieldCount; i++) {
        Leb128.writeUnsignedLeb128(out, adjustString(reader.readAnnotationName()));
        transform(reader);
    }
}
 
Example 2
Source File: IndexMap.java    From Box with Apache License 2.0 5 votes vote down vote up
private void transformArray(EncodedValueReader reader) {
    int size = reader.readArray();
    Leb128.writeUnsignedLeb128(out, size);
    for (int i = 0; i < size; i++) {
        transform(reader);
    }
}
 
Example 3
Source File: ByteArrayAnnotatedOutput.java    From Box with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public int writeUleb128(int value) {
    if (stretchy) {
        ensureCapacity(cursor + 5); // pessimistic
    }
    int cursorBefore = cursor;
    Leb128.writeUnsignedLeb128(this, value);
    return (cursor - cursorBefore);
}
 
Example 4
Source File: IndexMap.java    From Box with Apache License 2.0 5 votes vote down vote up
private void transformAnnotation(EncodedValueReader reader) {
    int fieldCount = reader.readAnnotation();
    Leb128.writeUnsignedLeb128(out, adjustType(reader.getAnnotationType()));
    Leb128.writeUnsignedLeb128(out, fieldCount);
    for (int i = 0; i < fieldCount; i++) {
        Leb128.writeUnsignedLeb128(out, adjustString(reader.readAnnotationName()));
        transform(reader);
    }
}
 
Example 5
Source File: IndexMap.java    From Box with Apache License 2.0 5 votes vote down vote up
private void transformArray(EncodedValueReader reader) {
    int size = reader.readArray();
    Leb128.writeUnsignedLeb128(out, size);
    for (int i = 0; i < size; i++) {
        transform(reader);
    }
}
 
Example 6
Source File: ByteArrayAnnotatedOutput.java    From Box with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public int writeUleb128(int value) {
    if (stretchy) {
        ensureCapacity(cursor + 5); // pessimistic
    }
    int cursorBefore = cursor;
    Leb128.writeUnsignedLeb128(this, value);
    return (cursor - cursorBefore);
}
 
Example 7
Source File: ByteArrayAnnotatedOutput.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
   @Override
public int writeUleb128(int value) {
       if (stretchy) {
           ensureCapacity(cursor + 5); // pessimistic
       }
       int cursorBefore = cursor;
       Leb128.writeUnsignedLeb128(this, value);
       return (cursor - cursorBefore);
   }
 
Example 8
Source File: IndexMap.java    From buck with Apache License 2.0 5 votes vote down vote up
private void transformAnnotation(EncodedValueReader reader) {
    int fieldCount = reader.readAnnotation();
    Leb128.writeUnsignedLeb128(out, adjustType(reader.getAnnotationType()));
    Leb128.writeUnsignedLeb128(out, fieldCount);
    for (int i = 0; i < fieldCount; i++) {
        Leb128.writeUnsignedLeb128(out, adjustString(reader.readAnnotationName()));
        transform(reader);
    }
}
 
Example 9
Source File: IndexMap.java    From buck with Apache License 2.0 5 votes vote down vote up
private void transformArray(EncodedValueReader reader) {
    int size = reader.readArray();
    Leb128.writeUnsignedLeb128(out, size);
    for (int i = 0; i < size; i++) {
        transform(reader);
    }
}
 
Example 10
Source File: ByteArrayAnnotatedOutput.java    From buck with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
public int writeUleb128(int value) {
    if (stretchy) {
        ensureCapacity(cursor + 5); // pessimistic
    }
    int cursorBefore = cursor;
    Leb128.writeUnsignedLeb128(this, value);
    return (cursor - cursorBefore);
}
 
Example 11
Source File: Leb128UtilsTest.java    From buck with Apache License 2.0 4 votes vote down vote up
private byte[] encodeUnsignedLeb(int value) {
    ByteArrayAnnotatedOutput out = new ByteArrayAnnotatedOutput(5);
    Leb128.writeUnsignedLeb128(out, value);
    return out.toByteArray();
}