public abstract class MessageSerializer extends Object
Constructor and Description |
---|
MessageSerializer() |
Modifier and Type | Method and Description |
---|---|
abstract Message |
deserialize(ByteBuffer in)
Reads a message from the given ByteBuffer and returns it.
|
abstract BitcoinSerializer.BitcoinPacketHeader |
deserializeHeader(ByteBuffer in)
Deserializes only the header in case packet meta data is needed before decoding
the payload.
|
abstract Message |
deserializePayload(BitcoinSerializer.BitcoinPacketHeader header,
ByteBuffer in)
Deserialize payload only.
|
abstract boolean |
isParseRetainMode()
Whether the serializer will produce cached mode Messages
|
abstract AddressMessage |
makeAddressMessage(byte[] payloadBytes,
int length)
Make an address message from the payload.
|
abstract Message |
makeAlertMessage(byte[] payloadBytes)
Make an alert message from the payload.
|
Block |
makeBlock(byte[] payloadBytes)
Make a block from the payload, using an offset of zero and the payload
length as block length.
|
Block |
makeBlock(byte[] payloadBytes,
int length)
Make a block from the payload, using an offset of zero and the provided
length as block length.
|
abstract Block |
makeBlock(byte[] payloadBytes,
int offset,
int length)
Make a block from the payload, using an offset of zero and the provided
length as block length.
|
abstract Message |
makeBloomFilter(byte[] payloadBytes)
Make an filter message from the payload.
|
abstract FilteredBlock |
makeFilteredBlock(byte[] payloadBytes)
Make a filtered block from the payload.
|
abstract InventoryMessage |
makeInventoryMessage(byte[] payloadBytes,
int length)
Make an inventory message from the payload.
|
Transaction |
makeTransaction(byte[] payloadBytes)
Make a transaction from the payload.
|
Transaction |
makeTransaction(byte[] payloadBytes,
int offset)
Make a transaction from the payload.
|
abstract Transaction |
makeTransaction(byte[] payloadBytes,
int offset,
int length,
byte[] hash)
Make a transaction from the payload.
|
abstract void |
seekPastMagicBytes(ByteBuffer in) |
abstract void |
serialize(Message message,
OutputStream out)
Writes message to to the output stream.
|
abstract void |
serialize(String name,
byte[] message,
OutputStream out)
Writes message to to the output stream.
|
public abstract Message deserialize(ByteBuffer in) throws ProtocolException, IOException, UnsupportedOperationException
public abstract BitcoinSerializer.BitcoinPacketHeader deserializeHeader(ByteBuffer in) throws ProtocolException, IOException, UnsupportedOperationException
public abstract Message deserializePayload(BitcoinSerializer.BitcoinPacketHeader header, ByteBuffer in) throws ProtocolException, BufferUnderflowException, UnsupportedOperationException
BitcoinSerializer.deserializeHeader(java.nio.ByteBuffer)
.public abstract boolean isParseRetainMode()
public abstract AddressMessage makeAddressMessage(byte[] payloadBytes, int length) throws ProtocolException, UnsupportedOperationException
public abstract Message makeAlertMessage(byte[] payloadBytes) throws ProtocolException, UnsupportedOperationException
public final Block makeBlock(byte[] payloadBytes) throws ProtocolException
ProtocolException
public final Block makeBlock(byte[] payloadBytes, int length) throws ProtocolException
ProtocolException
public abstract Block makeBlock(byte[] payloadBytes, int offset, int length) throws ProtocolException, UnsupportedOperationException
public abstract Message makeBloomFilter(byte[] payloadBytes) throws ProtocolException, UnsupportedOperationException
public abstract FilteredBlock makeFilteredBlock(byte[] payloadBytes) throws ProtocolException, UnsupportedOperationException
public abstract InventoryMessage makeInventoryMessage(byte[] payloadBytes, int length) throws ProtocolException, UnsupportedOperationException
public abstract Transaction makeTransaction(byte[] payloadBytes, int offset, int length, byte[] hash) throws ProtocolException, UnsupportedOperationException
UnsupportedOperationException
- if this serializer/deserializer
does not support deserialization. This can occur either because it's a dummy
serializer (i.e. for messages with no network parameters), or because
it does not support deserializing transactions.ProtocolException
public final Transaction makeTransaction(byte[] payloadBytes) throws ProtocolException, UnsupportedOperationException
UnsupportedOperationException
- if this serializer/deserializer
does not support deserialization. This can occur either because it's a dummy
serializer (i.e. for messages with no network parameters), or because
it does not support deserializing transactions.ProtocolException
public final Transaction makeTransaction(byte[] payloadBytes, int offset) throws ProtocolException
UnsupportedOperationException
- if this serializer/deserializer
does not support deserialization. This can occur either because it's a dummy
serializer (i.e. for messages with no network parameters), or because
it does not support deserializing transactions.ProtocolException
public abstract void seekPastMagicBytes(ByteBuffer in) throws BufferUnderflowException
BufferUnderflowException
public abstract void serialize(String name, byte[] message, OutputStream out) throws IOException, UnsupportedOperationException
UnsupportedOperationException
- if this serializer/deserializer
does not support serialization. This can occur either because it's a dummy
serializer (i.e. for messages with no network parameters), or because
it does not support serializing the given message.IOException
public abstract void serialize(Message message, OutputStream out) throws IOException, UnsupportedOperationException
UnsupportedOperationException
- if this serializer/deserializer
does not support serialization. This can occur either because it's a dummy
serializer (i.e. for messages with no network parameters), or because
it does not support serializing the given message.IOException
Copyright © 2016. All rights reserved.