當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。