本文整理汇总了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.");
}
}
}
示例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);
});
}
}
示例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);
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
}
}
}