Package org.bitcoinj.core
Class Ping
- java.lang.Object
-
- org.bitcoinj.core.Message
-
- org.bitcoinj.core.Ping
-
public class Ping extends Message
Instances of this class are not safe for use by multiple threads.
-
-
Field Summary
-
Fields inherited from class org.bitcoinj.core.Message
cursor, length, MAX_SIZE, offset, params, payload, recached, serializer, UNKNOWN_LENGTH
-
-
Constructor Summary
Constructors Constructor Description Ping()
Create a Ping without a nonce value.Ping(long nonce)
Create a Ping with a nonce value.Ping(NetworkParameters params, byte[] payloadBytes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bitcoinSerializeToStream(java.io.OutputStream stream)
Serializes this message to the provided stream.long
getNonce()
boolean
hasNonce()
protected void
parse()
-
Methods inherited from class org.bitcoinj.core.Message
adjustLength, bitcoinSerialize, bitcoinSerialize, getHash, getMessageSize, getParams, hasMoreBytes, isCached, isRecached, readByte, readByteArray, readBytes, readHash, readInt64, readStr, readUint32, readUint64, readVarInt, readVarInt, setSerializer, unCache, unsafeBitcoinSerialize
-
-
-
-
Constructor Detail
-
Ping
public Ping(NetworkParameters params, byte[] payloadBytes) throws ProtocolException
- Throws:
ProtocolException
-
Ping
public Ping(long nonce)
Create a Ping with a nonce value. Only use this if the remote node has a protocol version greater than 60000
-
Ping
public Ping()
Create a Ping without a nonce value. Only use this if the remote node has a protocol version lower than or equal 60000
-
-
Method Detail
-
bitcoinSerializeToStream
public void bitcoinSerializeToStream(java.io.OutputStream stream) throws java.io.IOException
Description copied from class:Message
Serializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().- Overrides:
bitcoinSerializeToStream
in classMessage
- Throws:
java.io.IOException
-
parse
protected void parse() throws ProtocolException
- Specified by:
parse
in classMessage
- Throws:
ProtocolException
-
hasNonce
public boolean hasNonce()
-
getNonce
public long getNonce()
-
-