|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.metastatic.rsync.RebuilderStream
A "streaming" alternative to Rebuilder
. To use this class,
create an intsance with a file argument representing the file being
rebuilt. Then register one or more implementations of the RebuilderListener
interface, which will write the data to the new
file. Then call the update(Delta)
method for each Delta
to be applied.
Note that unlike the GeneratorStream
and MatcherStream
classes this class does not need a Configuration
, nor does it have any "doFinal" method -- it is
completely stateless (except for the file) and the operations are
finished when the last delta has been applied.
This class is optimal for situations where the deltas are coming in a stream over a communications link, and when it would be inefficient to wait until all deltas are received.
Field Summary | |
---|---|
protected RandomAccessFile |
basisFile
The basis file. |
protected LinkedList |
listeners
The list of RebuilderListener s. |
Constructor Summary | |
---|---|
RebuilderStream()
Create a new rebuilder. |
Method Summary | |
---|---|
void |
addListener(RebuilderListener listener)
Add a RebuilderListener listener to this rebuilder. |
void |
doFinal()
|
void |
removeListener(RebuilderListener listener)
Remove a listener from this rebuilder. |
void |
setBasisFile(File file)
Set the basis file. |
void |
setBasisFile(String file)
Set the basis file. |
void |
update(Delta delta)
Update this rebuilder with a delta. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected RandomAccessFile basisFile
protected final LinkedList listeners
RebuilderListener
s.
Constructor Detail |
public RebuilderStream()
Method Detail |
public void addListener(RebuilderListener listener)
listener
- The listener to add.
IllegalArgumentException
- If listener is null.public void removeListener(RebuilderListener listener)
listener
- The listener to remove.public void setBasisFile(File file) throws IOException
file
- The basis file.
IOException
- If the file is not readable.public void setBasisFile(String file) throws IOException
file
- The basis file name.
IOException
- If the file name is not the name of a readable file.public void doFinal() throws IOException
IOException
public void update(Delta delta) throws IOException, ListenerException
delta
- The delta to apply.
IOException
- If there is an error reading from the basis
file, or if no basis file has been specified.
ListenerException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |