Class WKTDictionary.Loader

java.lang.Object
org.apache.sis.io.wkt.WKTDictionary.Loader
Enclosing class:
WKTDictionary

private final class WKTDictionary.Loader extends Object
Implementation of WKTDictionary.load(BufferedReader) method. Caller must own the write lock before to instantiate and use this class.
  • Field Details

  • Constructor Details

  • Method Details

    • restore

      final void restore()
      Restores WKTDictionary.parser to its initial state. This method should be invoked in a finally block regardless if the parsing succeeded or failed.
    • canNotRead

      final String canNotRead(String cause, Exception e)
      Returns an error message saying "Cannot read WKT at line X". The message is followed by a "Caused by" phrase specified either as a string or an exception. At least one of cause and e shall be non-null.
    • getLineNumber

      private int getLineNumber()
      Returns the one-based line number of the last line read. Actually this method returns the zero-based line number of current position, but since current position is after the last line read, this is equivalent to line number of last line read + 1.
      Returns:
      one-based line number of current position.
    • read

      final void read() throws IOException, ParseException, FactoryDataException
      Adds to the enclosing factory all definitions read from the given source. See WKTDictionary.load(BufferedReader) for a format description.
      Throws:
      IOException - if an error occurred while reading lines.
      ParseException - if an error occurred while parsing a WKT.
      FactoryDataException - if the file has a syntax error.
      IllegalArgumentException - if a codespace:version:code tuple or an alias is assigned twice.
    • addAliasOrDefinition

      private void addAliasOrDefinition() throws ParseException, FactoryDataException
      Parses the current buffer content as a WKT elements (possibly with children elements). This method does not build the full IdentifiedObject; this latter part will be done only when first needed.

      If aliasKey is non-null, the first WKT is taken as a fragment associated to the given alias. All other WKT (if any) are taken as definitions of CRS or other objects.

      Throws:
      ParseException - if an error occurred while parsing the WKT string.
      FactoryDataException - if there is unparsed text after the WKT.
      IllegalArgumentException - if a codespace:version:code tuple or an alias is assigned twice.