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


Java ByteArrayDataInput.readShort方法代码示例

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


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

import com.google.common.io.ByteArrayDataInput; //导入方法依赖的package包/类
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
    if (!channel.equals("BungeeCord")) {
        return;
    }
    final ByteArrayDataInput in = ByteStreams.newDataInput(message);
    final String type = in.readUTF();
    if (type.equals("ServerIP")) {
        final String serverName = in.readUTF();
        final String ip = in.readUTF();
        final short port = in.readShort();
        this.plugin.getServer().getScheduler().runTaskAsynchronously(this.plugin, () -> {
            final String data = BungeeCordProvider.this.receiveResultFromServer(serverName, ip, port);
            BungeeCordProvider.this.parseData(serverName, data);
        });
    }
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:18,代码来源:BungeeCordProvider.java

示例3: 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

示例4: readItemStack

import com.google.common.io.ByteArrayDataInput; //导入方法依赖的package包/类
public static ItemStack readItemStack(ByteArrayDataInput par0DataInputStream) throws IOException {
    ItemStack itemstack = null;
    short short1 = par0DataInputStream.readShort();

    if (short1 >= 0) {
        byte b0 = par0DataInputStream.readByte();
        short short2 = par0DataInputStream.readShort();
        itemstack = new ItemStack(short1, b0, short2);
        itemstack.stackTagCompound = readNBTTagCompound(par0DataInputStream);
    }

    return itemstack;
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:14,代码来源:BattlegearUtils.java

示例5: 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

示例6: feed

import com.google.common.io.ByteArrayDataInput; //导入方法依赖的package包/类
public void feed(ByteArrayDataInput fifo) {
	short damnt = fifo.readShort();
	for (int i=0; i<damnt; i++)
	{
		data[dataidx++] = (short) (fifo.readByte() & 0xFF); //make it unsigned
	}
	finished = dataidx<data.length;
}
 
开发者ID:ds84182,项目名称:OpenGX,代码行数:9,代码来源:GXMap.java

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