Example usage for org.eclipse.jdt.internal.compiler.classfmt MethodInfo utf8At

List of usage examples for org.eclipse.jdt.internal.compiler.classfmt MethodInfo utf8At

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.classfmt MethodInfo utf8At.

Prototype

public char[] utf8At(int relativeOffset, int bytesAvailable) 

Source Link

Usage

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.bytecode.CopyInheritanceSourceAttribute.java

License:Open Source License

/**
 *  Read a CopyInheritanceSrc from byte code.
 *///www .  j  a va2s.c  o m
public static AbstractAttribute readcopyInherSrc(MethodInfo info, int readOffset, int structOffset,
        int[] constantPoolOffsets) {
    int idx = info.u2At(readOffset);
    int utf8Offset = constantPoolOffsets[idx] - structOffset;
    char[] value = info.utf8At(utf8Offset + 3, info.u2At(utf8Offset + 1));
    int lineOffset = 0;
    if (info.u2At(readOffset - 2) > 2) // old attribute length was 2 (without lineOffset)
        lineOffset = (int) info.u4At(readOffset + 2);
    AbstractAttribute result = new CopyInheritanceSourceAttribute(value, lineOffset);
    result._methodInfo = info;
    return result;
}