本文整理汇总了Java中com.strobel.assembler.metadata.Buffer.reset方法的典型用法代码示例。如果您正苦于以下问题:Java Buffer.reset方法的具体用法?Java Buffer.reset怎么用?Java Buffer.reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.strobel.assembler.metadata.Buffer
的用法示例。
在下文中一共展示了Buffer.reset方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}