Class ImageryReader
- java.lang.Object
-
- org.openstreetmap.josm.io.imagery.ImageryReader
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class ImageryReader extends Object implements Closeable
Reader to parse the list of available imagery servers from an XML definition file.The format is specified in the JOSM wiki.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ImageryReader.Parser
private static class
ImageryReader.State
-
Field Summary
Fields Modifier and Type Field Description private CachedFile
cachedFile
private boolean
fastFail
private String
source
-
Constructor Summary
Constructors Constructor Description ImageryReader(String source)
Constructs aImageryReader
from a given filename, URL or internal resource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
List<ImageryInfo>
parse()
Parses imagery source.void
setFastFail(boolean fastFail)
Sets whether opening HTTP connections should fail fast, i.e., whether alow connect timeout
should be used.
-
-
-
Field Detail
-
cachedFile
private CachedFile cachedFile
-
fastFail
private boolean fastFail
-
-
Constructor Detail
-
ImageryReader
public ImageryReader(String source)
Constructs aImageryReader
from a given filename, URL or internal resource.- Parameters:
source
- can be:- relative or absolute file name
file:///SOME/FILE
the same as abovehttp://...
a URL. It will be cached on disk.resource://SOME/FILE
file from the classpath (usually in the current *.jar)josmdir://SOME/FILE
file inside josm user data directory (since r7058)josmplugindir://SOME/FILE
file inside josm plugin directory (since r7834)
-
-
Method Detail
-
parse
public List<ImageryInfo> parse() throws SAXException, IOException
Parses imagery source.- Returns:
- list of imagery info
- Throws:
SAXException
- if any SAX error occursIOException
- if any I/O error occurs
-
setFastFail
public void setFastFail(boolean fastFail)
Sets whether opening HTTP connections should fail fast, i.e., whether alow connect timeout
should be used.- Parameters:
fastFail
- whether opening HTTP connections should fail fast- See Also:
CachedFile.setFastFail(boolean)
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-