当前位置: 首页>>代码示例>>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;未经允许,请勿转载。