本文整理匯總了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;
}
}
}
}