當前位置: 首頁>>代碼示例>>Java>>正文


Java ByteArrayDataInput.readInt方法代碼示例

本文整理匯總了Java中com.google.common.io.ByteArrayDataInput.readInt方法的典型用法代碼示例。如果您正苦於以下問題:Java ByteArrayDataInput.readInt方法的具體用法?Java ByteArrayDataInput.readInt怎麽用?Java ByteArrayDataInput.readInt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.common.io.ByteArrayDataInput的用法示例。


在下文中一共展示了ByteArrayDataInput.readInt方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: constant

import com.google.common.io.ByteArrayDataInput; //導入方法依賴的package包/類
/**
 * Reads a constant value at the given index, which must be one of CONSTANT_String_info,
 * CONSTANT_Integer_info, CONSTANT_Float_info, CONSTANT_Long_info, or CONSTANT_Double_info.
 */
Const.Value constant(int index) {
  ByteArrayDataInput reader = byteReader.seek(constantPool[index - 1]);
  byte tag = reader.readByte();
  switch (tag) {
    case CONSTANT_LONG:
      return new Const.LongValue(reader.readLong());
    case CONSTANT_FLOAT:
      return new Const.FloatValue(reader.readFloat());
    case CONSTANT_DOUBLE:
      return new Const.DoubleValue(reader.readDouble());
    case CONSTANT_INTEGER:
      return new Const.IntValue(reader.readInt());
    case CONSTANT_STRING:
      return new Const.StringValue(utf8(reader.readUnsignedShort()));
    default:
      throw new AssertionError(String.format("bad tag: %x", tag));
  }
}
 
開發者ID:google,項目名稱:turbine,代碼行數:23,代碼來源:ConstantPoolReader.java

示例2: readPermissionRequest

import com.google.common.io.ByteArrayDataInput; //導入方法依賴的package包/類
/**
 * Reads a permission request.
 */
public static PermissionRequest readPermissionRequest(
		Player player, byte[] data) {
	ByteArrayDataInput input = ByteStreams.newDataInput(data);
	
	String requestReason = input.readUTF();
	
	Map<String, String> requestedPerms = new HashMap<>();
	int numRequests = input.readInt();
	for (int i = 0; i < numRequests; i++) {
		String key = input.readUTF();
		String value = input.readUTF();
		
		requestedPerms.put(key, value);
	}
	
	List<ProtectionRange> rangeRequests = new ArrayList<>();
	int numRangeRequests = input.readInt();
	for (int i = 0; i < numRangeRequests; i++) {
		rangeRequests.add(readProtectionRange(input));
	}
	
	return new PermissionRequest(player, requestReason, requestedPerms,
			rangeRequests);
}
 
開發者ID:Pokechu22,項目名稱:WorldDownloader-Serverside-Companion,代碼行數:28,代碼來源:WDLPackets.java

示例3: consumePacket

import com.google.common.io.ByteArrayDataInput; //導入方法依賴的package包/類
@Override
public FMLPacket consumePacket(byte[] data)
{
    sentModList = Lists.newArrayList();
    ByteArrayDataInput in = ByteStreams.newDataInput(data);
    int listSize = in.readInt();
    for (int i = 0; i < listSize; i++)
    {
        sentModList.add(in.readUTF());
    }
    try
    {
        compatibilityLevel = in.readByte();
    }
    catch (IllegalStateException e)
    {
        FMLLog.fine("No compatibility byte found - the server is too old");
    }
    return this;
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:21,代碼來源:ModListRequestPacket.java

示例4: consumePacket

import com.google.common.io.ByteArrayDataInput; //導入方法依賴的package包/類
@Override
public FMLPacket consumePacket(byte[] data)
{
    ByteArrayDataInput dat = ByteStreams.newDataInput(data);
    int versionListSize = dat.readInt();
    modVersions = Maps.newHashMapWithExpectedSize(versionListSize);
    for (int i = 0; i < versionListSize; i++)
    {
        String modName = dat.readUTF();
        String modVersion = dat.readUTF();
        modVersions.put(modName, modVersion);
    }

    int missingModSize = dat.readInt();
    missingMods = Lists.newArrayListWithExpectedSize(missingModSize);

    for (int i = 0; i < missingModSize; i++)
    {
        missingMods.add(dat.readUTF());
    }
    return this;
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:23,代碼來源:ModListResponsePacket.java

示例5: accept

import com.google.common.io.ByteArrayDataInput; //導入方法依賴的package包/類
@Override
public boolean accept(Player receiver, ByteArrayDataInput in) {
    String ip = in.readUTF();
    int port = in.readInt();
    callback.accept(Maps.immutableEntry(ip, port));
    return true;
}
 
開發者ID:lucko,項目名稱:helper,代碼行數:8,代碼來源:BungeeMessaging.java

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

示例7: getClusterIds

import com.google.common.io.ByteArrayDataInput; //導入方法依賴的package包/類
/**
 * @return the set of clusterIds that have consumed the mutation
 */
public List<UUID> getClusterIds() {
  List<UUID> clusterIds = new ArrayList<UUID>();
  byte[] bytes = getAttribute(CONSUMED_CLUSTER_IDS);
  if(bytes != null) {
    ByteArrayDataInput in = ByteStreams.newDataInput(bytes);
    int numClusters = in.readInt();
    for(int i=0; i<numClusters; i++){
      clusterIds.add(new UUID(in.readLong(), in.readLong()));
    }
  }
  return clusterIds;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:16,代碼來源:Mutation.java

示例8: read

import com.google.common.io.ByteArrayDataInput; //導入方法依賴的package包/類
@Override
public void read(ByteArrayDataInput stream) {
	this.friends.clear();
	int size = stream.readInt();
	for (int i = 0; i < size; i++) {
		this.friends.add(stream.readUTF());
	}
}
 
開發者ID:CreepPlaysDE,項目名稱:RewiMod,代碼行數:9,代碼來源:RMPacketFriends.java

示例9: getClusterIds

import com.google.common.io.ByteArrayDataInput; //導入方法依賴的package包/類
/**
 * @return the set of cluster Ids that have consumed the mutation
 */
public List<UUID> getClusterIds() {
  List<UUID> clusterIds = new ArrayList<UUID>();
  byte[] bytes = getAttribute(CONSUMED_CLUSTER_IDS);
  if(bytes != null) {
    ByteArrayDataInput in = ByteStreams.newDataInput(bytes);
    int numClusters = in.readInt();
    for(int i=0; i<numClusters; i++){
      clusterIds.add(new UUID(in.readLong(), in.readLong()));
    }
  }
  return clusterIds;
}
 
開發者ID:fengchen8086,項目名稱:LCIndex-HBase-0.94.16,代碼行數:16,代碼來源:Mutation.java

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

示例11: getClusterIds

import com.google.common.io.ByteArrayDataInput; //導入方法依賴的package包/類
/**
 * @return the set of clusterIds that have consumed the mutation
 */
public List<UUID> getClusterIds() {
    List<UUID> clusterIds = new ArrayList<UUID>();
    byte[] bytes = getAttribute(CONSUMED_CLUSTER_IDS);
    if (bytes != null) {
        ByteArrayDataInput in = ByteStreams.newDataInput(bytes);
        int numClusters = in.readInt();
        for (int i = 0; i < numClusters; i++) {
            clusterIds.add(new UUID(in.readLong(), in.readLong()));
        }
    }
    return clusterIds;
}
 
開發者ID:grokcoder,項目名稱:pbase,代碼行數:16,代碼來源:Mutation.java

示例12: readFields

import com.google.common.io.ByteArrayDataInput; //導入方法依賴的package包/類
/**
 * @param bytes
 * @throws IOException
 */
public void readFields(byte[] bytes) throws IOException {
  ByteArrayDataInput in = ByteStreams.newDataInput(bytes);
  int indicesSize = in.readInt();
  indices.clear();
  for (int i = 0; i < indicesSize; i++) {
    IndexSpecification is = new IndexSpecification();
    is.readFields(in);
    this.indices.add(is);
  }
}
 
開發者ID:tenggyut,項目名稱:HIndex,代碼行數:15,代碼來源:TableIndices.java

示例13: consumePacket

import com.google.common.io.ByteArrayDataInput; //導入方法依賴的package包/類
@Override
public ForgePacket consumePacket(byte[] data)
{
    ByteArrayDataInput dat = ByteStreams.newDataInput(data);
    dimensionId = dat.readInt();
    providerId = dat.readInt();
    return this;
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:9,代碼來源:DimensionRegisterPacket.java

示例14: recievePacket

import com.google.common.io.ByteArrayDataInput; //導入方法依賴的package包/類
@Override
public void recievePacket(ByteArrayDataInput data) {
	fuel = data.readInt();
	maxFuel = data.readInt();
	cookTime = data.readInt();
	direction = (byte)data.readInt();
	heat = data.readInt();
}
 
開發者ID:TheAwesomeGem,項目名稱:MineFantasy,代碼行數:9,代碼來源:TileEntityBFurnace.java

示例15: read

import com.google.common.io.ByteArrayDataInput; //導入方法依賴的package包/類
@Override
public void read(ByteArrayDataInput in) {
    windowId = in.readInt();
    marketId = in.readInt();
    cartIndex = in.readInt();

    int itemId = in.readInt();
    int stackSize = in.readInt();
    int damage = in.readInt();

    Item item = (Item)Item.itemRegistry.getObjectById(itemId);
    itemToAddOrUpdate = new ItemStack(item, stackSize, damage);

    addIfUnlocated = in.readBoolean();
}
 
開發者ID:CannibalVox,項目名稱:ModJamTeleporters,代碼行數:16,代碼來源:TransmitCartUpdatePacket.java


注:本文中的com.google.common.io.ByteArrayDataInput.readInt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。