org.openstreetmap.josm.io
Class OsmServerReader

java.lang.Object
  extended by org.openstreetmap.josm.io.OsmConnection
      extended by org.openstreetmap.josm.io.OsmServerReader
Direct Known Subclasses:
BoundingBoxDownloader, MultiFetchServerObjectReader, MultiFetchServerObjectReader.Fetcher, OsmServerBackreferenceReader, OsmServerChangesetReader, OsmServerHistoryReader, OsmServerLocationReader, OsmServerObjectReader, OsmServerUserInfoReader

public abstract class OsmServerReader
extends OsmConnection

This DataReader reads directly from the REST API of the osm server. It supports plain text transfer as well as gzip or deflate encoded transfers; if compressed transfers are unwanted, set property osm-server.use-compression to false.


Field Summary
private  OsmApi api
           
private  boolean doAuthenticate
           
 
Fields inherited from class org.openstreetmap.josm.io.OsmConnection
activeConnection, cancel, oauthParameters
 
Constructor Summary
OsmServerReader()
           
 
Method Summary
private  java.io.InputStream FixEncoding(java.io.InputStream stream, java.lang.String encoding)
           
protected  java.lang.String getBaseUrl()
           
protected  java.io.InputStream getInputStream(java.lang.String urlStr, ProgressMonitor progressMonitor)
          Open a connection to the given url and return a reader on the input stream from that connection.
protected  java.io.InputStream getInputStreamRaw(java.lang.String urlStr, ProgressMonitor progressMonitor)
           
 boolean isDoAuthenticate()
          Returns true if this reader is adding authentication credentials to the read request sent to the server.
abstract  DataSet parseOsm(ProgressMonitor progressMonitor)
           
 DataSet parseOsmBzip2(ProgressMonitor progressMonitor)
           
 DataSet parseOsmChange(ProgressMonitor progressMonitor)
           
 DataSet parseOsmChangeBzip2(ProgressMonitor progressMonitor)
           
 DataSet parseOsmChangeGzip(ProgressMonitor progressMonitor)
           
 DataSet parseOsmGzip(ProgressMonitor progressMonitor)
           
 GpxData parseRawGps(ProgressMonitor progressMonitor)
           
 void setDoAuthenticate(boolean doAuthenticate)
          Sets whether this reader adds authentication credentials to the read request sent to the server.
 
Methods inherited from class org.openstreetmap.josm.io.OsmConnection
addAuth, addBasicAuthorizationHeader, addOAuthAuthorizationHeader, cancel, isCanceled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

api

private OsmApi api

doAuthenticate

private boolean doAuthenticate
Constructor Detail

OsmServerReader

public OsmServerReader()
Method Detail

getInputStream

protected java.io.InputStream getInputStream(java.lang.String urlStr,
                                             ProgressMonitor progressMonitor)
                                      throws OsmTransferException
Open a connection to the given url and return a reader on the input stream from that connection. In case of user cancel, return null.

Parameters:
urlStr - The exact url to connect to.
pleaseWaitDlg -
Returns:
An reader reading the input stream (servers answer) or null.
Throws:
OsmTransferException

getBaseUrl

protected java.lang.String getBaseUrl()

getInputStreamRaw

protected java.io.InputStream getInputStreamRaw(java.lang.String urlStr,
                                                ProgressMonitor progressMonitor)
                                         throws OsmTransferException
Throws:
OsmTransferException

FixEncoding

private java.io.InputStream FixEncoding(java.io.InputStream stream,
                                        java.lang.String encoding)
                                 throws java.io.IOException
Throws:
java.io.IOException

parseOsm

public abstract DataSet parseOsm(ProgressMonitor progressMonitor)
                          throws OsmTransferException
Throws:
OsmTransferException

parseOsmChange

public DataSet parseOsmChange(ProgressMonitor progressMonitor)
                       throws OsmTransferException
Throws:
OsmTransferException

parseOsmChangeBzip2

public DataSet parseOsmChangeBzip2(ProgressMonitor progressMonitor)
                            throws OsmTransferException
Throws:
OsmTransferException

parseOsmChangeGzip

public DataSet parseOsmChangeGzip(ProgressMonitor progressMonitor)
                           throws OsmTransferException
Throws:
OsmTransferException

parseRawGps

public GpxData parseRawGps(ProgressMonitor progressMonitor)
                    throws OsmTransferException
Throws:
OsmTransferException

parseOsmBzip2

public DataSet parseOsmBzip2(ProgressMonitor progressMonitor)
                      throws OsmTransferException
Throws:
OsmTransferException

parseOsmGzip

public DataSet parseOsmGzip(ProgressMonitor progressMonitor)
                     throws OsmTransferException
Throws:
OsmTransferException

isDoAuthenticate

public boolean isDoAuthenticate()
Returns true if this reader is adding authentication credentials to the read request sent to the server.

Returns:
true if this reader is adding authentication credentials to the read request sent to the server

setDoAuthenticate

public void setDoAuthenticate(boolean doAuthenticate)
Sets whether this reader adds authentication credentials to the read request sent to the server.

Parameters:
doAuthenticate - true if this reader adds authentication credentials to the read request sent to the server


JOSM