Class ImageryReader
- java.lang.Object
-
- org.openstreetmap.josm.io.imagery.ImageryReader
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class ImageryReader extends java.lang.Object implements java.io.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 classImageryReader.Parserprivate static classImageryReader.State
-
Field Summary
Fields Modifier and Type Field Description private CachedFilecachedFileprivate booleanfastFailprivate java.lang.Stringsource
-
Constructor Summary
Constructors Constructor Description ImageryReader(java.lang.String source)Constructs aImageryReaderfrom a given filename, URL or internal resource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.util.List<ImageryInfo>parse()Parses imagery source.voidsetFastFail(boolean fastFail)Sets whether opening HTTP connections should fail fast, i.e., whether alow connect timeoutshould be used.
-
-
-
Field Detail
-
source
private final java.lang.String source
-
cachedFile
private CachedFile cachedFile
-
fastFail
private boolean fastFail
-
-
Constructor Detail
-
ImageryReader
public ImageryReader(java.lang.String source)
Constructs aImageryReaderfrom a given filename, URL or internal resource.- Parameters:
source- can be:- relative or absolute file name
file:///SOME/FILEthe same as abovehttp://...a URL. It will be cached on disk.resource://SOME/FILEfile from the classpath (usually in the current *.jar)josmdir://SOME/FILEfile inside josm user data directory (since r7058)josmplugindir://SOME/FILEfile inside josm plugin directory (since r7834)
-
-
Method Detail
-
parse
public java.util.List<ImageryInfo> parse() throws org.xml.sax.SAXException, java.io.IOException
Parses imagery source.- Returns:
- list of imagery info
- Throws:
org.xml.sax.SAXException- if any SAX error occursjava.io.IOException- 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 timeoutshould be used.- Parameters:
fastFail- whether opening HTTP connections should fail fast- See Also:
CachedFile.setFastFail(boolean)
-
close
public void close() throws java.io.IOException
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
-