本文整理汇总了Java中com.sun.tools.hat.internal.parser.ReadBuffer.getInt方法的典型用法代码示例。如果您正苦于以下问题:Java ReadBuffer.getInt方法的具体用法?Java ReadBuffer.getInt怎么用?Java ReadBuffer.getInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.hat.internal.parser.ReadBuffer
的用法示例。
在下文中一共展示了ReadBuffer.getInt方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readValue
import com.sun.tools.hat.internal.parser.ReadBuffer; //导入方法依赖的package包/类
protected final byte[] readValue() throws IOException {
JavaClass cl = getClazz();
ReadBuffer buf = cl.getReadBuffer();
int idSize = cl.getIdentifierSize();
long offset = getOffset() + idSize + 4;
// length of the array
int length = buf.getInt(offset);
// typecode of array element type
byte type = buf.getByte(offset + 4);
if (length == 0) {
return Snapshot.EMPTY_BYTE_ARRAY;
} else {
length *= elementSize(type);
byte[] res = new byte[length];
buf.get(offset + 5, res);
return res;
}
}
示例2: readValueLength
import com.sun.tools.hat.internal.parser.ReadBuffer; //导入方法依赖的package包/类
protected final int readValueLength() throws IOException {
JavaClass cl = getClazz();
ReadBuffer buf = cl.getReadBuffer();
int idSize = cl.getIdentifierSize();
long offset = getOffset() + idSize + 4;
// length of the array
int len = buf.getInt(offset);
// typecode of array element type
byte type = buf.getByte(offset + 4);
return len * elementSize(type);
}
示例3: readValueLength
import com.sun.tools.hat.internal.parser.ReadBuffer; //导入方法依赖的package包/类
protected final int readValueLength() throws IOException {
JavaClass cl = getClazz();
ReadBuffer buf = cl.getReadBuffer();
int idSize = cl.getIdentifierSize();
long offset = getOffset() + idSize + 4;
int len = buf.getInt(offset);
return len * cl.getIdentifierSize();
}
示例4: readValue
import com.sun.tools.hat.internal.parser.ReadBuffer; //导入方法依赖的package包/类
protected final byte[] readValue() throws IOException {
JavaClass cl = getClazz();
ReadBuffer buf = cl.getReadBuffer();
int idSize = cl.getIdentifierSize();
long offset = getOffset() + idSize + 4;
int len = buf.getInt(offset);
if (len == 0) {
return Snapshot.EMPTY_BYTE_ARRAY;
} else {
byte[] res = new byte[len * idSize];
buf.get(offset + 4 + idSize, res);
return res;
}
}
示例5: resolve
import com.sun.tools.hat.internal.parser.ReadBuffer; //导入方法依赖的package包/类
public void resolve(Snapshot snapshot) {
if (clazz instanceof JavaClass) {
return;
}
if (clazz instanceof Number) {
long classID = getIdValue((Number)clazz);
clazz = snapshot.findThing(classID);
if (! (clazz instanceof JavaClass)) {
warn("Class " + Long.toHexString(classID) + " not found, " +
"adding fake class!");
int length;
ReadBuffer buf = snapshot.getReadBuffer();
int idSize = snapshot.getIdentifierSize();
long lenOffset = getOffset() + 2*idSize + 4;
try {
length = buf.getInt(lenOffset);
} catch (IOException exp) {
throw new RuntimeException(exp);
}
clazz = snapshot.addFakeInstanceClass(classID, length);
}
} else {
throw new InternalError("should not reach here");
}
JavaClass cl = (JavaClass) clazz;
cl.resolve(snapshot);
// while resolving, parse fields in verbose mode.
// but, getFields calls parseFields in non-verbose mode
// to avoid printing warnings repeatedly.
parseFields(getValue(), true);
cl.addInstance(this);
super.resolve(snapshot);
}
示例6: readValue
import com.sun.tools.hat.internal.parser.ReadBuffer; //导入方法依赖的package包/类
protected final byte[] readValue() throws IOException {
JavaClass cl = getClazz();
int idSize = cl.getIdentifierSize();
ReadBuffer buf = cl.getReadBuffer();
long offset = getOffset() + 2*idSize + 4;
int length = buf.getInt(offset);
if (length == 0) {
return Snapshot.EMPTY_BYTE_ARRAY;
} else {
byte[] res = new byte[length];
buf.get(offset + 4, res);
return res;
}
}
示例7: getId
import com.sun.tools.hat.internal.parser.ReadBuffer; //导入方法依赖的package包/类
public final long getId() {
try {
ReadBuffer buf = getClazz().getReadBuffer();
int idSize = getClazz().getIdentifierSize();
if (idSize == 4) {
return ((long)buf.getInt(offset)) & Snapshot.SMALL_ID_MASK;
} else {
return buf.getLong(offset);
}
} catch (IOException exp) {
System.err.println("lazy read failed at offset " + offset);
exp.printStackTrace();
return -1;
}
}