本文整理汇总了Java中com.strobel.assembler.metadata.Buffer类的典型用法代码示例。如果您正苦于以下问题:Java Buffer类的具体用法?Java Buffer怎么用?Java Buffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Buffer类属于com.strobel.assembler.metadata包,在下文中一共展示了Buffer类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tryLoadType
import com.strobel.assembler.metadata.Buffer; //导入依赖的package包/类
@Override
public boolean tryLoadType(String className, Buffer out) {
// check the cache
byte[] data;
if (m_cache.containsKey(className)) {
data = m_cache.get(className);
} else {
data = loadType(className);
m_cache.put(className, data);
}
if (data == null) {
// chain to default type loader
return m_defaultTypeLoader.tryLoadType(className, out);
}
// send the class to the decompiler
out.reset(data.length);
System.arraycopy(data, 0, out.array(), out.position(), data.length);
out.position(0);
return true;
}
示例2: tryLoadType
import com.strobel.assembler.metadata.Buffer; //导入依赖的package包/类
@Override
public boolean tryLoadType(String className, Buffer out) {
// check the cache
byte[] data;
if (this.cache.containsKey(className)) {
data = this.cache.get(className);
} else {
data = loadType(className);
this.cache.put(className, data);
}
if (data == null) {
// chain to default type loader
return this.defaultTypeLoader.tryLoadType(className, out);
}
// send the class to the decompiler
out.reset(data.length);
System.arraycopy(data, 0, out.array(), out.position(), data.length);
out.position(0);
return true;
}
示例3: tryLoadType
import com.strobel.assembler.metadata.Buffer; //导入依赖的package包/类
@Override
public boolean tryLoadType(String className, Buffer out)
{
// check the cache
byte[] data;
if(m_cache.containsKey(className))
data = m_cache.get(className);
else
{
data = loadType(className);
m_cache.put(className, data);
}
if(data == null)
// chain to default type loader
return m_defaultTypeLoader.tryLoadType(className, out);
// send the class to the decompiler
out.reset(data.length);
System.arraycopy(data, 0, out.array(), out.position(), data.length);
out.position(0);
return true;
}
示例4: tryLoadType
import com.strobel.assembler.metadata.Buffer; //导入依赖的package包/类
@Override
public boolean tryLoadType(final String internalName, final Buffer buffer) {
for (final ITypeLoader typeLoader : _typeLoaders) {
if (typeLoader.tryLoadType(internalName, buffer)) {
return true;
}
buffer.reset();
}
return false;
}
示例5: tryLoadType
import com.strobel.assembler.metadata.Buffer; //导入依赖的package包/类
@Override
public boolean tryLoadType(final String internalName, final Buffer buffer) {
for (final ITypeLoader typeLoader : _typeLoaders) {
if (typeLoader.tryLoadType(internalName, buffer)) {
return true;
}
buffer.reset();
}
return false;
}
示例6: tryLoadType
import com.strobel.assembler.metadata.Buffer; //导入依赖的package包/类
@Override
public boolean tryLoadType(final String internalName, final Buffer buffer)
{
try
{
if (LOG.isLoggable(Level.FINE))
{
LOG.fine("Attempting to load type: " + internalName + "...");
}
final JarEntry entry = _jarFile.getJarEntry(internalName + ".class");
if (entry == null)
{
final String mappedName = _knownMappings.get(internalName);
return mappedName != null &&
!mappedName.equals(internalName) && tryLoadType(mappedName, buffer);
}
final InputStream inputStream = _jarFile.getInputStream(entry);
int remainingBytes = inputStream.available();
buffer.reset(remainingBytes);
while (remainingBytes > 0)
{
final int bytesRead = inputStream.read(buffer.array(), buffer.position(), remainingBytes);
if (bytesRead < 0)
{
break;
}
buffer.position(buffer.position() + bytesRead);
remainingBytes -= bytesRead;
}
buffer.position(0);
final String actualName = getInternalNameFromClassFile(buffer);
if (actualName != null && !actualName.equals(internalName))
{
_knownMappings.put(actualName, internalName);
}
if (LOG.isLoggable(Level.FINE))
{
LOG.fine("Type loaded from " + _jarFile.getName() + "!" + entry.getName() + ".");
}
return true;
}
catch (IOException e)
{
throw ExceptionUtilities.asRuntimeException(e);
}
}
示例7: getInternalNameFromClassFile
import com.strobel.assembler.metadata.Buffer; //导入依赖的package包/类
private static String getInternalNameFromClassFile(final Buffer b)
{
final long magic = b.readInt() & 0xFFFFFFFFL;
if (magic != 0xCAFEBABEL)
{
return null;
}
b.readUnsignedShort(); // minor version
b.readUnsignedShort(); // major version
final ConstantPool constantPool = ConstantPool.read(b);
b.readUnsignedShort(); // access flags
final ConstantPool.TypeInfoEntry thisClass = constantPool.getEntry(b.readUnsignedShort());
b.position(0);
return thisClass.getName();
}