com.google.bitcoin.core
Class BitcoinSerializer

java.lang.Object
  extended by com.google.bitcoin.core.BitcoinSerializer

public class BitcoinSerializer
extends Object

Methods to serialize and de-serialize messages to the bitcoin network format as defined in the bitcoin protocol specification at https://en.bitcoin.it/wiki/Protocol_specification To be able to serialize and deserialize new Message subclasses the following criteria needs to be met.


Constructor Summary
BitcoinSerializer(NetworkParameters params, boolean usesChecksumming)
          Constructs a BitcoinSerializer with the given behavior.
 
Method Summary
 Message deserialize(InputStream in)
          Reads a message from the given InputStream and returns it.
 void serialize(Message message, OutputStream out)
          Writes message to to the output stream.
 void useChecksumming(boolean usesChecksumming)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BitcoinSerializer

public BitcoinSerializer(NetworkParameters params,
                         boolean usesChecksumming)
Constructs a BitcoinSerializer with the given behavior.

Parameters:
params - networkParams used to create Messages instances and termining packetMagic
usesChecksumming - set to true if checkums should be included and expected in headers
Method Detail

useChecksumming

public void useChecksumming(boolean usesChecksumming)

serialize

public void serialize(Message message,
                      OutputStream out)
               throws IOException
Writes message to to the output stream.

Throws:
IOException

deserialize

public Message deserialize(InputStream in)
                    throws ProtocolException,
                           IOException
Reads a message from the given InputStream and returns it.

Throws:
ProtocolException
IOException


Copyright © 2011. All Rights Reserved.