public class TileDeliveryOperation
extends java.util.Observable
TileDeliveryOperation
represents an asynchronous process for
delivering tiles of data from a TileSource
to a number of
Observer
objects. Each observer receives a TilingScheme.Tile
object after each tile has been read from the source. If an exception is
encountered while delivering tiles, the observer object will be null, and
the getLastReadException
method will return the latest exception
received.Constructor and Description |
---|
TileDeliveryOperation(TileSource source,
java.lang.Iterable<TilingScheme.TilePosition> positions)
Creates a new delivery operation that reads tiles from a source.
|
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels this operation.
|
java.io.IOException |
getLastReadException()
Gets the last exception received from reading tiles from the source.
|
TileSource |
getSource()
Gets the source for this delivery operation.
|
boolean |
isFinished()
Checks if this operation is finished.
|
static void |
main(java.lang.String[] argv)
Tests this class.
|
void |
start()
Starts the operation.
|
void |
waitUntilFinished()
Waits for the operation to finish.
|
public TileDeliveryOperation(TileSource source, java.lang.Iterable<TilingScheme.TilePosition> positions)
source
- the source to read tile data from.positions
- the positions to read.start()
public TileSource getSource()
public java.io.IOException getLastReadException()
public void start()
waitUntilFinished()
,
cancel()
,
isFinished
public void waitUntilFinished() throws java.lang.InterruptedException
java.lang.InterruptedException
- if the current thread is interrupted waiting
for the operation to finish.public void cancel()
start()
method has been called.public boolean isFinished()
public static void main(java.lang.String[] argv) throws java.lang.Exception
argv
- the array of command line parameters.java.lang.Exception