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


Java ByteArrayDataInput.readFully方法代码示例

本文整理汇总了Java中com.google.common.io.ByteArrayDataInput.readFully方法的典型用法代码示例。如果您正苦于以下问题:Java ByteArrayDataInput.readFully方法的具体用法?Java ByteArrayDataInput.readFully怎么用?Java ByteArrayDataInput.readFully使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.io.ByteArrayDataInput的用法示例。


在下文中一共展示了ByteArrayDataInput.readFully方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPluginMessageReceived

import com.google.common.io.ByteArrayDataInput; //导入方法依赖的package包/类
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
	if (!channel.equals("BungeeCord")) {
		return;
	}
	ByteArrayDataInput in = ByteStreams.newDataInput(message);
	String subchannel = in.readUTF();
	
	if (subchannel.equals("SkyWarsReloadedRequest")) { 
		short len = in.readShort();
		byte[] msgbytes = new byte[len];
		in.readFully(msgbytes);

		Game game = gc.getGame(1);
		if (game != null) {
				BungeeUtil.sendSignUpdateRequest(game);
		} else {
			System.out.println("Game " + game + " couldn't be found, please fix your setup.");
		}
	}
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:21,代码来源:SkyWarsReloaded.java

示例2: readPatch

import com.google.common.io.ByteArrayDataInput; //导入方法依赖的package包/类
private ClassPatch readPatch(JarEntry entry, JarInputStream jis){
    ByteArrayDataInput input;
    try{
        input = ByteStreams.newDataInput(ByteStreams.toByteArray(jis));
    }catch(IOException e){
        logger.warn("Unable to read binpatch file {}. Ignoring it", entry.getName());
        return null;
    }
    String name = input.readUTF();
    String sourceName = input.readUTF();
    String targetName = input.readUTF();
    boolean exists = input.readBoolean();
    int inputChecksum = exists ? input.readInt() : 0;
    int patchLength = input.readInt();
    byte[] patchBytes = new byte[patchLength];
    input.readFully(patchBytes);

    return new ClassPatch(name, sourceName, targetName, exists, inputChecksum, patchBytes);
}
 
开发者ID:nailed,项目名称:nailed,代码行数:20,代码来源:BinPatchManager.java

示例3: consumePacket

import com.google.common.io.ByteArrayDataInput; //导入方法依赖的package包/类
@Override
public FMLPacket consumePacket(byte[] data)
{
    ByteArrayDataInput bdi = ByteStreams.newDataInput(data);
    int chunkIdx = UnsignedBytes.toInt(bdi.readByte());
    int chunkTotal = UnsignedBytes.toInt(bdi.readByte());
    int chunkLength = bdi.readInt();
    if (partials == null)
    {
        partials = new byte[chunkTotal][];
    }
    partials[chunkIdx] = new byte[chunkLength];
    bdi.readFully(partials[chunkIdx]);
    for (int i = 0; i < partials.length; i++)
    {
        if (partials[i] == null)
        {
            return null;
        }
    }
    return this;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:23,代码来源:ModIdMapPacket.java

示例4: accept

import com.google.common.io.ByteArrayDataInput; //导入方法依赖的package包/类
@Override
public boolean accept(Player receiver, ByteArrayDataInput in) {
    short len = in.readShort();
    byte[] data = new byte[len];
    in.readFully(data);

    return callback.test(data);
}
 
开发者ID:lucko,项目名称:helper,代码行数:9,代码来源:BungeeMessaging.java

示例5: readPatch

import com.google.common.io.ByteArrayDataInput; //导入方法依赖的package包/类
private ClassPatch readPatch(JarEntry patchEntry, JarInputStream jis)
{
    if (DEBUG)
        FMLRelaunchLog.finer("Reading patch data from %s", patchEntry.getName());
    ByteArrayDataInput input;
    try
    {
        input = ByteStreams.newDataInput(ByteStreams.toByteArray(jis));
    }
    catch (IOException e)
    {
        FMLRelaunchLog.log(Level.WARN, e, "Unable to read binpatch file %s - ignoring", patchEntry.getName());
        return null;
    }
    String name = input.readUTF();
    String sourceClassName = input.readUTF();
    String targetClassName = input.readUTF();
    boolean exists = input.readBoolean();
    int inputChecksum = 0;
    if (exists)
    {
        inputChecksum = input.readInt();
    }
    int patchLength = input.readInt();
    byte[] patchBytes = new byte[patchLength];
    input.readFully(patchBytes);

    return new ClassPatch(name, sourceClassName, targetClassName, exists, inputChecksum, patchBytes);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:30,代码来源:ClassPatchManager.java

示例6: readPatch

import com.google.common.io.ByteArrayDataInput; //导入方法依赖的package包/类
private ClassPatch readPatch(JarEntry patchEntry, JarInputStream jis)
{
    FMLRelaunchLog.finer("Reading patch data from %s", patchEntry.getName());
    ByteArrayDataInput input;
    try
    {
        input = ByteStreams.newDataInput(ByteStreams.toByteArray(jis));
    }
    catch (IOException e)
    {
        FMLRelaunchLog.log(Level.WARN, e, "Unable to read binpatch file %s - ignoring", patchEntry.getName());
        return null;
    }
    String name = input.readUTF();
    String sourceClassName = input.readUTF();
    String targetClassName = input.readUTF();
    boolean exists = input.readBoolean();
    int inputChecksum = 0;
    if (exists)
    {
        inputChecksum = input.readInt();
    }
    int patchLength = input.readInt();
    byte[] patchBytes = new byte[patchLength];
    input.readFully(patchBytes);

    return new ClassPatch(name, sourceClassName, targetClassName, exists, inputChecksum, patchBytes);
}
 
开发者ID:alexandrage,项目名称:CauldronGit,代码行数:29,代码来源:ClassPatchManager.java

示例7: readNBTTagCompound

import com.google.common.io.ByteArrayDataInput; //导入方法依赖的package包/类
/**
 * Reads a compressed NBTTagCompound from the InputStream
 */
public static NBTTagCompound readNBTTagCompound(ByteArrayDataInput par0DataInputStream) throws IOException {
    short short1 = par0DataInputStream.readShort();

    if (short1 < 0) {
        return null;
    } else {
        byte[] abyte = new byte[short1];
        par0DataInputStream.readFully(abyte);

        return CompressedStreamTools.decompress(abyte);
    }
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:16,代码来源:BattlegearUtils.java

示例8: readNBTTagCompound

import com.google.common.io.ByteArrayDataInput; //导入方法依赖的package包/类
public static NBTTagCompound readNBTTagCompound(ByteArrayDataInput stream) throws IOException
{
    int id = stream.readInt();

    if (id < 0)
    {
        return null;
    }
    else
    {
        byte[] abyte = new byte[id];
        stream.readFully(abyte);
        return CompressedStreamTools.decompress(abyte);
    }
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:16,代码来源:PacketManagerMF.java

示例9: decode

import com.google.common.io.ByteArrayDataInput; //导入方法依赖的package包/类
@Override
public VersionedData<byte[], Integer> decode(byte[] encoded) {
	ByteArrayDataInput in = ByteStreams.newDataInput(encoded);
	int version = in.readInt();
	byte[] data = new byte[encoded.length - 4];
	in.readFully(data);
	return new VersionedData<byte[], Integer>(data, version);
}
 
开发者ID:agwlvssainokuni,项目名称:sqlapp,代码行数:9,代码来源:DefaultVersionStrategy.java

示例10: bytesToType

import com.google.common.io.ByteArrayDataInput; //导入方法依赖的package包/类
@Override
protected BigDecimal bytesToType(byte[] p) {
	ByteArrayDataInput in = ByteStreams.newDataInput(p);
	int scale = in.readInt();
	byte[] buff = new byte[p.length - 4];
	in.readFully(buff);
	BigInteger bi = new BigInteger(buff);
	return new BigDecimal(bi, scale);
}
 
开发者ID:agwlvssainokuni,项目名称:sqlapp,代码行数:10,代码来源:SecureBigDecimalEncoder.java

示例11: readPatch

import com.google.common.io.ByteArrayDataInput; //导入方法依赖的package包/类
private ClassPatch readPatch(JarEntry patchEntry, JarInputStream jis)
{
    FMLRelaunchLog.finest("Reading patch data from %s", patchEntry.getName());
    ByteArrayDataInput input;
    try
    {
        input = ByteStreams.newDataInput(ByteStreams.toByteArray(jis));
    }
    catch (IOException e)
    {
        FMLRelaunchLog.log(Level.WARNING, e, "Unable to read binpatch file %s - ignoring", patchEntry.getName());
        return null;
    }
    String name = input.readUTF();
    String sourceClassName = input.readUTF();
    String targetClassName = input.readUTF();
    boolean exists = input.readBoolean();
    int inputChecksum = 0;
    if (exists)
    {
        inputChecksum = input.readInt();
    }
    int patchLength = input.readInt();
    byte[] patchBytes = new byte[patchLength];
    input.readFully(patchBytes);

    return new ClassPatch(name, sourceClassName, targetClassName, exists, inputChecksum, patchBytes);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:29,代码来源:ClassPatchManager.java

示例12: consumePart

import com.google.common.io.ByteArrayDataInput; //导入方法依赖的package包/类
private ForgePacket consumePart(INetworkManager network, byte[] data)
{
    if (partTracker == null)
    {
        partTracker = new MapMaker().weakKeys().weakValues().makeMap();
    }
    if (!partTracker.containsKey(network))
    {
        partTracker.put(network, make());
    }

    ForgePacket pkt = partTracker.get(network);

    ByteArrayDataInput bdi = ByteStreams.newDataInput(data);
    int chunkIdx = UnsignedBytes.toInt(bdi.readByte());
    int chunkTotal = UnsignedBytes.toInt(bdi.readByte());
    int chunkLength = bdi.readInt();

    if (pkt.partials == null)
    {
        pkt.partials = new byte[chunkTotal][];
    }

    pkt.partials[chunkIdx] = new byte[chunkLength];
    bdi.readFully(pkt.partials[chunkIdx]);
    for (int i = 0; i < pkt.partials.length; i++)
    {
        if (pkt.partials[i] == null)
        {
            return null;
        }
    }

    return pkt;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:36,代码来源:ForgePacket.java

示例13: load

import com.google.common.io.ByteArrayDataInput; //导入方法依赖的package包/类
@Override
public void load(NBTTagCompound nbt) {
	if (node != null)
		node.load(nbt);
	tier = nbt.getInteger("tier")+1;
	monitorAddress = nbt.getString("monitor");
	if (monitorAddress.length() == 0)
		monitorAddress = null;
	init();
       if (romGX != null) {
       	romGX.load(nbt.getCompoundTag("oc:romnode"));
       }
       
       NBTTagList stateReloadPackets = nbt.getTagList("state", 10);
       if (stateReloadPackets != null)
       {
       	for (int i=0; i<stateReloadPackets.tagCount(); i++)
       	{
       		NBTTagCompound pkt = stateReloadPackets.getCompoundTagAt(i);
       		IGX.DataType type = IGX.DataType.values()[pkt.getInteger("type")];
       		byte[] data = nbt.getByteArray("data");
       		ByteArrayDataInput dat = ByteStreams.newDataInput(data);
       		switch (type)
       		{
			case FIFO:
				gx.uploadFIFO(dat,data);
				break;
			case TEXTURE:
				int id = dat.readShort();
				int fmt = dat.readByte();
				int size = dat.readInt();
				byte[] texdata = new byte[size];
				dat.readFully(texdata);
				gx.uploadTexture((short) id, new ByteArrayInputStream(texdata), (byte) fmt);
				break;
       		}
       	}
       }
}
 
开发者ID:ds84182,项目名称:OpenGX,代码行数:40,代码来源:ComponentGX.java


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