当前位置: 首页>>代码示例>>Java>>正文


Java DataInputStream.readLong方法代码示例

本文整理汇总了Java中java.io.DataInputStream.readLong方法的典型用法代码示例。如果您正苦于以下问题:Java DataInputStream.readLong方法的具体用法?Java DataInputStream.readLong怎么用?Java DataInputStream.readLong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.io.DataInputStream的用法示例。


在下文中一共展示了DataInputStream.readLong方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: read

import java.io.DataInputStream; //导入方法依赖的package包/类
/**
 * Read partition meta from input stream
 * @param input
 * @throws IOException
 */
public void read(DataInputStream input) throws IOException {
  partId = input.readInt();
  startRow = input.readInt();
  endRow = input.readInt();
  startCol = input.readLong();
  endCol = input.readLong();
  nnz = input.readLong();
  fileName = input.readUTF();
  offset = input.readLong();
  length = input.readLong();
  rowMetas = new HashMap<>();

  int rowIndexNum = input.readInt();
  for(int i = 0; i < rowIndexNum; i++) {
    RowOffset rowOffset = new RowOffset(input.readInt(), input.readLong());
    rowMetas.put(rowOffset.rowId, rowOffset);
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:24,代码来源:ModelPartitionMeta.java

示例2: deserialize

import java.io.DataInputStream; //导入方法依赖的package包/类
void deserialize(DataInputStream inputStream) throws IOException {
  byte [] header = new byte[TRAILERBLOCKMAGIC.length];
  inputStream.readFully(header);
  if ( !Arrays.equals(header, TRAILERBLOCKMAGIC)) {
    throw new IOException("Trailer 'header' is wrong; does the trailer " +
      "size match content?");
  }
  fileinfoOffset         = inputStream.readLong();
  dataIndexOffset        = inputStream.readLong();
  dataIndexCount         = inputStream.readInt();

  metaIndexOffset        = inputStream.readLong();
  metaIndexCount         = inputStream.readInt();

  totalUncompressedBytes = inputStream.readLong();
  entryCount             = inputStream.readInt();
  compressionCodec       = inputStream.readInt();
  version                = inputStream.readInt();

  if (version != 1) {
    throw new IOException("Wrong version: " + version);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:24,代码来源:IndexFile.java

示例3: deserialiseRequest

import java.io.DataInputStream; //导入方法依赖的package包/类
public static PRUDPPacketRequest
deserialiseRequest(
	PRUDPPacketHandler	handler,
	DataInputStream		is )

	throws IOException
{
	long		connection_id 	= is.readLong();
	int			action			= is.readInt();
	int			transaction_id	= is.readInt();

	PRUDPPacketRequestDecoder	decoder = (PRUDPPacketRequestDecoder)packet_decoders.get( new Integer( action ));

	if ( decoder == null ){

		throw( new IOException( "No decoder registered for action '" + action + "'" ));
	}

	return( decoder.decode( handler, is, connection_id, action, transaction_id ));
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:21,代码来源:PRUDPPacketRequest.java

示例4: revalidate

import java.io.DataInputStream; //导入方法依赖的package包/类
protected void revalidate(QuorumPacket qp) throws IOException {
    ByteArrayInputStream bis = new ByteArrayInputStream(qp
            .getData());
    DataInputStream dis = new DataInputStream(bis);
    long sessionId = dis.readLong();
    boolean valid = dis.readBoolean();
    ServerCnxn cnxn = pendingRevalidations
    .remove(sessionId);
    if (cnxn == null) {
        LOG.warn("Missing session 0x"
                + Long.toHexString(sessionId)
                + " for validation");
    } else {
        zk.finishSessionInit(cnxn, valid);
    }
    if (LOG.isTraceEnabled()) {
        ZooTrace.logTraceMessage(LOG,
                ZooTrace.SESSION_TRACE_MASK,
                "Session 0x" + Long.toHexString(sessionId)
                + " is valid: " + valid);
    }
}
 
开发者ID:l294265421,项目名称:ZooKeeper,代码行数:23,代码来源:Learner.java

示例5: PRUDPPacketRequestAnnounce

import java.io.DataInputStream; //导入方法依赖的package包/类
protected
PRUDPPacketRequestAnnounce(
	DataInputStream		is,
	long				con_id,
	int					trans_id )

	throws IOException
{
	super( PRUDPPacketTracker.ACT_REQUEST_ANNOUNCE, con_id, trans_id );

	hash 	= new byte[20];
	peer_id	= new byte[20];

	is.read( hash );
	is.read( peer_id );

	downloaded 	= is.readLong();
	left		= is.readLong();
	uploaded	= is.readLong();
	event 		= is.readInt();
	ip_address	= is.readInt();
	num_want	= is.readInt();
	port		= is.readShort();
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:25,代码来源:PRUDPPacketRequestAnnounce.java

示例6: read

import java.io.DataInputStream; //导入方法依赖的package包/类
public void read(DataInputStream paramDataInputStream) throws IOException {
    this.iTag = paramDataInputStream.readByte();
    switch (this.iTag) {
        case 7:
            this.iNameIndex = paramDataInputStream.readUnsignedShort();
            break;
        case 8:
            this.iStringIndex = paramDataInputStream.readUnsignedShort();
            break;
        case 9:
        case 10:
        case 11:
            this.iClassIndex = paramDataInputStream.readUnsignedShort();
            this.iNameAndTypeIndex = paramDataInputStream.readUnsignedShort();
            break;
        case 3:
            this.iIntValue = paramDataInputStream.readInt();
            break;
        case 4:
            this.fFloatVal = paramDataInputStream.readFloat();
            break;
        case 12:
            this.iNameIndex = paramDataInputStream.readUnsignedShort();
            this.iDescriptorIndex = paramDataInputStream.readUnsignedShort();
            break;
        case 5:
            this.lLongVal = paramDataInputStream.readLong();
            break;
        case 6:
            this.dDoubleVal = paramDataInputStream.readDouble();
            break;
        case 1:
            this.sUTFStr = paramDataInputStream.readUTF();
            break;
        case 2:
        default:
            System.out.println("Unknown constant pool type: " + this.iTag);
    }
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:40,代码来源:ConstantPoolInfo.java

示例7: readFrom

import java.io.DataInputStream; //导入方法依赖的package包/类
/**
 * Reads a byte stream, which was written by {@linkplain #writeTo(OutputStream)}, into a
 * {@code BloomFilter<T>}.
 *
 * The {@code Funnel} to be used is not encoded in the stream, so it must be provided here.
 * <b>Warning:</b> the funnel provided <b>must</b> behave identically to the one used to populate
 * the original Bloom filter!
 *
 * @throws IOException if the InputStream throws an {@code IOException}, or if its data does not
 *     appear to be a BloomFilter serialized using the {@linkplain #writeTo(OutputStream)} method.
 */
public static <T> BloomFilter<T> readFrom(InputStream in, Funnel<T> funnel) throws IOException {
  checkNotNull(in, "InputStream");
  checkNotNull(funnel, "Funnel");
  int strategyOrdinal = -1;
  int numHashFunctions = -1;
  int dataLength = -1;
  try {
    DataInputStream din = new DataInputStream(in);
    // currently this assumes there is no negative ordinal; will have to be updated if we
    // add non-stateless strategies (for which we've reserved negative ordinals; see
    // Strategy.ordinal()).
    strategyOrdinal = din.readByte();
    numHashFunctions = UnsignedBytes.toInt(din.readByte());
    dataLength = din.readInt();

    Strategy strategy = BloomFilterStrategies.values()[strategyOrdinal];
    long[] data = new long[dataLength];
    for (int i = 0; i < data.length; i++) {
      data[i] = din.readLong();
    }
    return new BloomFilter<T>(new BitArray(data), numHashFunctions, funnel, strategy);
  } catch (RuntimeException e) {
    String message =
        "Unable to deserialize BloomFilter from InputStream."
            + " strategyOrdinal: "
            + strategyOrdinal
            + " numHashFunctions: "
            + numHashFunctions
            + " dataLength: "
            + dataLength;
    throw new IOException(message, e);
  }
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:45,代码来源:BloomFilter.java

示例8: read

import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
protected void read(DataInputStream instr) throws Exception {
    index.rootPos = new BlockPointer(instr.readLong());

    short actualChildIndexEntries = instr.readShort();
    if (actualChildIndexEntries != maxChildIndexEntries) {
        throw blockCorruptedException();
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:BTreePersistentIndexedCache.java

示例9: PRUDPPacketReplyConnect

import java.io.DataInputStream; //导入方法依赖的package包/类
protected
PRUDPPacketReplyConnect(
	DataInputStream		is,
	int					trans_id )

	throws IOException
{
	super( PRUDPPacketTracker.ACT_REPLY_CONNECT, trans_id );

	connection_id = is.readLong();
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:12,代码来源:PRUDPPacketReplyConnect.java

示例10: createValidateSessionPacketResponse

import java.io.DataInputStream; //导入方法依赖的package包/类
/**
 * Forge an invalid session packet as a LEADER do
 *
 * @param valid <code>true</code> to create a valid session message
 *
 * @throws Exception
 */
private QuorumPacket createValidateSessionPacketResponse(boolean valid) throws Exception {
    QuorumPacket qp = createValidateSessionPacket();
    ByteArrayInputStream bis = new ByteArrayInputStream(qp.getData());
    DataInputStream dis = new DataInputStream(bis);
    long id = dis.readLong();
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    DataOutputStream dos = new DataOutputStream(bos);
    dos.writeLong(id);
    // false means that the session has expired
    dos.writeBoolean(valid);
    qp.setData(bos.toByteArray());
    return qp;
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:21,代码来源:WatchLeakTest.java

示例11: read

import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
public void read(DataInputStream in) throws IOException {
    // We need to use the offset, since the start time
    // is different and we couldn't save absolute values
    long deadOffset = in.readLong();
    deadTime = startTime + deadOffset;
    highScore = in.readInt();
}
 
开发者ID:LonamiWebs,项目名称:Klooni1010,代码行数:9,代码来源:TimeScorer.java

示例12: readFromStream

import java.io.DataInputStream; //导入方法依赖的package包/类
public void readFromStream(DataInputStream in) throws IOException {
    super.readFromStream(in);

    nProfiledClasses = in.readInt();
    classNames = new String[nProfiledClasses];
    objectsSizePerClass = new long[nProfiledClasses];

    for (int i = 0; i < nProfiledClasses; i++) {
        classNames[i] = in.readUTF();
        objectsSizePerClass[i] = in.readLong();
    }

    if (in.readBoolean()) {
        int len = in.readInt();
        //System.err.println("Read len: " +len);
        stacksForClasses = new RuntimeMemoryCCTNode[len];

        for (int i = 0; i < len; i++) {
            int type = in.readInt();

            //System.err.println("  [" + i + "] = " + type);
            if (type != 0) {
                stacksForClasses[i] = RuntimeMemoryCCTNode.create(type);
                stacksForClasses[i].readFromStream(in);
            }
        }

        if (in.readBoolean()) {
            table = new JMethodIdTable();
            table.readFromStream(in);
        }
    }

    if (LOGGER.isLoggable(Level.FINEST)) {
        debugValues();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:MemoryResultsSnapshot.java

示例13: seekBCDISWithIndexFile

import java.io.DataInputStream; //导入方法依赖的package包/类
private void seekBCDISWithIndexFile(final BlockCompressedDataInputStream stream, final DataInputStream index,
        final long positon) throws IOException {
    //correct seek in file
    long seekPosition = positon + stream.getPosition();
    long filePosition = index.readLong();
    long seekPos = index.readLong();
    long helpSeekPosition = seekPosition - seekPos;
    while (helpSeekPosition >= 0) {
        seekPosition = helpSeekPosition;
        filePosition = index.readLong();
        seekPos = index.readLong();
        helpSeekPosition = seekPosition - seekPos;
    }
    stream.seek(filePosition + seekPosition);
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:16,代码来源:NibDataReader.java

示例14: read

import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
public void read(DataInputStream dataInputStream) throws Exception {
  clientTime = dataInputStream.readLong();
  
  PacketPingReply ppr = new PacketPingReply();
  ppr.clientTime = clientTime;
  getSocketMonitor().getSocketOutput().getPacketQueue().add(ppr);
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:9,代码来源:PacketPingRequest.java

示例15: readFromStream

import java.io.DataInputStream; //导入方法依赖的package包/类
public void readFromStream(DataInputStream in) throws IOException {
    threadId = in.readInt();
    threadName = in.readUTF();

    collectingTwoTimeStamps = in.readBoolean();

    int len = in.readInt();
    compactData = new byte[len];

    if (compactData.length > 0xFFFFFF) {
        childOfsSize = CHILD_OFS_SIZE_4;
    } else {
        childOfsSize = CHILD_OFS_SIZE_3;
    }

    in.readFully(compactData);

    nodeSize = in.readInt();

    wholeGraphGrossTimeAbs = in.readLong();
    wholeGraphGrossTimeThreadCPU = in.readLong();
    timeInInjectedCodeInAbsCounts = in.readDouble();
    timeInInjectedCodeInThreadCPUCounts = in.readDouble();
    wholeGraphPureTimeAbs = in.readLong();
    wholeGraphPureTimeThreadCPU = in.readLong();
    wholeGraphNetTime0 = in.readLong();
    wholeGraphNetTime1 = in.readLong();
    totalInvNo = in.readLong();
    displayWholeThreadCPUTime = in.readBoolean();

    rootNode = new PrestimeCPUCCTNodeBacked(this, null, 0);

    if (this.getMethodIdForNodeOfs(0) == 0) {
        rootNode.setThreadNode();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:CPUCCTContainer.java


注:本文中的java.io.DataInputStream.readLong方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。