org.metastatic.rsync
Class ChecksumDecoder

java.lang.Object
  |
  +--org.metastatic.rsync.ChecksumDecoder
Direct Known Subclasses:
ChecksumDecoder

public abstract class ChecksumDecoder
extends Object

The base class of objects that decode (internalize) checksum pairs from byte streams.


Field Summary
protected  Configuration config
          The configuration object.
protected  InputStream in
          The input stream being read from.
static String PROPERTY
          Property prefix for checksum encoders.
 
Constructor Summary
ChecksumDecoder(Configuration config, InputStream in)
           
 
Method Summary
static ChecksumEncoder getInstance(String encoding, Configuration config, InputStream in)
          Gets an instance of a checksum decoder for the specified encoding.
abstract  ChecksumPair read()
          Decodes a checksum pair from the input stream.
 int read(List sums)
          Decodes checksums from the stream, storing them into the specified list, until the end of checksums is encountered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY

public static final String PROPERTY
Property prefix for checksum encoders.

See Also:
Constant Field Values

config

protected Configuration config
The configuration object.


in

protected InputStream in
The input stream being read from.

Constructor Detail

ChecksumDecoder

public ChecksumDecoder(Configuration config,
                       InputStream in)
Method Detail

getInstance

public static ChecksumEncoder getInstance(String encoding,
                                          Configuration config,
                                          InputStream in)
Gets an instance of a checksum decoder for the specified encoding.

Parameters:
encoding - The encoding name.
config - The configuration object.
in - The input stream.
Throws:
NullPointerException - If any parameter is null.
IllegalArgumentException - If the specified encoding cannot be found, or if any of the arguments are inappropriate.

read

public int read(List sums)
         throws IOException
Decodes checksums from the stream, storing them into the specified list, until the end of checksums is encountered.

Parameters:
sums - The list to store the sums into.
Returns:
The number of checksums read.
Throws:
IOException - If an I/O error occurs.
NullPointerException - If any element of the list is null.

read

public abstract ChecksumPair read()
                           throws IOException
Decodes a checksum pair from the input stream.

Returns:
The pair read, or null if the end of stream is encountered.
Throws:
IOException - If an I/O error occurs.