当前位置: 首页>>代码示例>>Java>>正文


Java Buffer类代码示例

本文整理汇总了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;
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:24,代码来源:TranslatingTypeLoader.java

示例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;
}
 
开发者ID:OpenModLoader,项目名称:Enigma,代码行数:24,代码来源:TranslatingTypeLoader.java

示例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;
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-Enigma,代码行数:25,代码来源:TranslatingTypeLoader.java

示例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;
}
 
开发者ID:hsswx7,项目名称:CS4500GroupProject,代码行数:13,代码来源:LuytenTypeLoader.java

示例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;
}
 
开发者ID:KevinPriv,项目名称:Luyten4Forge,代码行数:13,代码来源:LuytenTypeLoader.java

示例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);
    }
}
 
开发者ID:windup,项目名称:windup,代码行数:61,代码来源:WindupJarTypeLoader.java

示例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();
}
 
开发者ID:windup,项目名称:windup,代码行数:23,代码来源:WindupJarTypeLoader.java


注:本文中的com.strobel.assembler.metadata.Buffer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。