Package ch.bitagent.bitcoin.lib.network
Class NetworkEnvelope
- java.lang.Object
-
- ch.bitagent.bitcoin.lib.network.NetworkEnvelope
-
public class NetworkEnvelope extends Object
NetworkEnvelope class.
-
-
Constructor Summary
Constructors Constructor Description NetworkEnvelope(byte[] command, byte[] payload, Boolean testnet)Constructor for NetworkEnvelope.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getCommand()Getter for the fieldcommand.byte[]getMagic()Getter for the fieldmagic.byte[]getPayload()Getter for the fieldpayload.BooleangetTestnet()Getter for the fieldtestnet.booleanisCommand(String command)isCommand.static NetworkEnvelopeparse(ByteArrayInputStream stream, Boolean testnet)Takes a stream and creates a NetworkEnvelopestatic intparseLength(ByteArrayInputStream stream)parseLength.byte[]serialize()Returns the byte serialization of the entire network messageStringtoString()
-
-
-
Method Detail
-
parseLength
public static int parseLength(ByteArrayInputStream stream)
parseLength.
- Parameters:
stream- aByteArrayInputStreamobject- Returns:
- a int
-
parse
public static NetworkEnvelope parse(ByteArrayInputStream stream, Boolean testnet)
Takes a stream and creates a NetworkEnvelope- Parameters:
stream- aByteArrayInputStreamobjecttestnet- aBooleanobject- Returns:
- a
NetworkEnvelopeobject
-
serialize
public byte[] serialize()
Returns the byte serialization of the entire network message- Returns:
- an array of
byteobjects
-
isCommand
public boolean isCommand(String command)
isCommand.
- Parameters:
command- aStringobject- Returns:
- a boolean
-
getCommand
public byte[] getCommand()
Getter for the field
command.- Returns:
- an array of
byteobjects
-
getPayload
public byte[] getPayload()
Getter for the field
payload.- Returns:
- an array of
byteobjects
-
getMagic
public byte[] getMagic()
Getter for the field
magic.- Returns:
- an array of
byteobjects
-
-