|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.bitcoin.core.BitcoinSerializer
public class BitcoinSerializer
Methods to serialize and de-serialize messages to the Bitcoin network format as defined in the protocol specification.
To be able to serialize and deserialize new Message subclasses the following criteria needs to be met.
| Nested Class Summary | |
|---|---|
static class |
BitcoinSerializer.BitcoinPacketHeader
|
| Constructor Summary | |
|---|---|
BitcoinSerializer(NetworkParameters params)
Constructs a BitcoinSerializer with the given behavior. |
|
BitcoinSerializer(NetworkParameters params,
boolean parseLazy,
boolean parseRetain)
Constructs a BitcoinSerializer with the given behavior. |
|
| Method Summary | |
|---|---|
Message |
deserialize(ByteBuffer in)
Reads a message from the given ByteBuffer and returns it. |
BitcoinSerializer.BitcoinPacketHeader |
deserializeHeader(ByteBuffer in)
Deserializes only the header in case packet meta data is needed before decoding the payload. |
Message |
deserializePayload(BitcoinSerializer.BitcoinPacketHeader header,
ByteBuffer in)
Deserialize payload only. |
boolean |
isParseLazyMode()
Whether the serializer will produce lazy parse mode Messages |
boolean |
isParseRetainMode()
Whether the serializer will produce cached mode Messages |
void |
seekPastMagicBytes(ByteBuffer in)
|
void |
serialize(Message message,
OutputStream out)
Writes message to to the output stream. |
void |
serialize(String name,
byte[] message,
OutputStream out)
Writes message to to the output stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BitcoinSerializer(NetworkParameters params)
params - networkParams used to create Messages instances and termining packetMagic
public BitcoinSerializer(NetworkParameters params,
boolean parseLazy,
boolean parseRetain)
params - networkParams used to create Messages instances and termining packetMagicparseLazy - deserialize messages in lazy mode.parseRetain - retain the backing byte array of a message for fast reserialization.| Method Detail |
|---|
public void serialize(String name,
byte[] message,
OutputStream out)
throws IOException
IOException
public void serialize(Message message,
OutputStream out)
throws IOException
IOException
public Message deserialize(ByteBuffer in)
throws ProtocolException,
IOException
ProtocolException
IOException
public BitcoinSerializer.BitcoinPacketHeader deserializeHeader(ByteBuffer in)
throws ProtocolException,
IOException
ProtocolException
IOException
public Message deserializePayload(BitcoinSerializer.BitcoinPacketHeader header,
ByteBuffer in)
throws ProtocolException,
BufferUnderflowException
deserializeHeader(java.nio.ByteBuffer).
ProtocolException
BufferUnderflowException
public void seekPastMagicBytes(ByteBuffer in)
throws BufferUnderflowException
BufferUnderflowExceptionpublic boolean isParseLazyMode()
public boolean isParseRetainMode()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||