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