uk.me.parabola.mkgmap.osmstyle
Class StyleFileLoader

java.lang.Object
  extended by uk.me.parabola.mkgmap.osmstyle.StyleFileLoader
Direct Known Subclasses:
CombinedStyleFileLoader, DirectoryFileLoader, JarFileLoader

public abstract class StyleFileLoader
extends java.lang.Object

Open a style which can be on the classpath (mainly for the built-in styles) or in a specified file or directory.

Author:
Steve Ratcliffe

Constructor Summary
StyleFileLoader()
           
 
Method Summary
abstract  void close()
          Close the FileLoader.
static StyleFileLoader createStyleLoader(java.lang.String loc, java.lang.String name)
          Open a style that is contained in a file.
abstract  java.lang.String[] list()
          List the names of the styles that are contained in this loader.
abstract  java.io.Reader open(java.lang.String filename)
          Open the specified file in the style definition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StyleFileLoader

public StyleFileLoader()
Method Detail

createStyleLoader

public static StyleFileLoader createStyleLoader(java.lang.String loc,
                                                java.lang.String name)
                                         throws java.io.FileNotFoundException
Open a style that is contained in a file. This is expected to be a directory or zip file containing the files that make up the style.

Parameters:
loc - The file or directory containing the style(s).
name - If the name is given then we look for a directory with the given name. If there is no name, then the style is assumed to be at the top level and/or the only file.
Returns:
A style loader.
Throws:
java.io.FileNotFoundException

open

public abstract java.io.Reader open(java.lang.String filename)
                             throws java.io.FileNotFoundException
Open the specified file in the style definition.

Parameters:
filename - The name of the file in the style.
Returns:
An open file reader for the file.
Throws:
java.io.FileNotFoundException - When the file can't be opened.

close

public abstract void close()
Close the FileLoader. This is different from closing individual files that were opened via open(java.lang.String). After this call then you shouldn't open any more files.


list

public abstract java.lang.String[] list()
List the names of the styles that are contained in this loader.

Returns:
An array of style names.