me.edwards.des.block
Class BlockChainIO

java.lang.Object
  extended by me.edwards.des.block.BlockChainIO

public class BlockChainIO
extends java.lang.Object

Handles reading and writing of BlockChains to and from the file system.

Created on: Dec 21, 2015 at 11:28:44 AM

Author:
Matthew Edwards

Field Summary
private static int BUFFER_SIZE
          Size of the read/write Buffer
 
Constructor Summary
BlockChainIO()
           
 
Method Summary
static BlockChain load(java.lang.String fileName)
          Loads a BlockChain from the specified file.
static void save(BlockChain bc, java.lang.String fileName)
          Saves the BlockChain to the specified file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFER_SIZE

private static final int BUFFER_SIZE
Size of the read/write Buffer

See Also:
Constant Field Values
Constructor Detail

BlockChainIO

public BlockChainIO()
Method Detail

save

public static void save(BlockChain bc,
                        java.lang.String fileName)
                 throws java.io.IOException
Saves the BlockChain to the specified file.

Parameters:
bc - BlockChain object to save
fileName - Full path of file in which to save
Throws:
java.io.IOException - Thrown if file writing encounters an error

load

public static BlockChain load(java.lang.String fileName)
                       throws java.io.IOException
Loads a BlockChain from the specified file.

Parameters:
fileName - Full path of file from which to load
Returns:
BlockChain loaded from file
Throws:
java.io.IOException - Thrown if file reading encounters an error or the fileName contains an invalid extension. (Only ".block" accepted)