class LTMTopicMapReader extends AbstractTopicMapReader {

  @Override
  protected TopicMapIF read(TopicMapStoreFactoryIF store_factory)
      throws IOException {
    TopicMapStoreIF store = store_factory.createStore();
    TopicMapIF topicmap = store.getTopicMap();

    // Set base address on in-memory store
    if ((store instanceof net.ontopia.topicmaps.impl.utils.AbstractTopicMapStore) &&
        store.getBaseAddress() == null)
      ((net.ontopia.topicmaps.impl.utils.AbstractTopicMapStore)store)
          .setBaseAddress(getBaseAddress());

    try (Reader reader = makeReader((String) null, new LTMEncodingSniffer())) {
       // Parse!
      LTMLexer lexer = new LTMLexer(reader);
      LTMParser parser = new LTMParser(lexer);
      parser.setBase(getBaseAddress());
      parser.setTopicMap(topicmap);
      parser.init();
      parser.topicmap();
      reader.close();
    } catch (AntlrWrapException ex) {
      throw (IOException) ex.getException();
    } catch (RecognitionException ex) {
      throw new IOException("Lexical error at " + getBaseAddress().getAddress()
          + ":" + ex.line + ":" + ex.column + ": "+ ex.getMessage());
    } catch (TokenStreamRecognitionException e) {
      RecognitionException ex = e.recog;
      throw new IOException("Lexical error at " + getBaseAddress().getAddress()
          + ":" + ex.line + ":" + ex.column + ": "+ ex.getMessage());
    } catch (TokenStreamIOException ex) {
      throw ex.io;
    } catch (TokenStreamException ex) {
      throw new IOException("Lexical error: " + ex.getMessage());
    } catch (java.io.CharConversionException e) {
      throw new IOException("Problem decoding character encoding."
          + "Did you declare the right encoding?");
    }

    // Process class-instance associations
    ClassInstanceUtils.resolveAssociations1(topicmap);

    return topicmap;
  }

  public  LTMTopicMapReader(URL url);
  public  LTMTopicMapReader(URL url, LocatorIF base_address);
  public  LTMTopicMapReader(Reader reader, LocatorIF base_address);
  public  LTMTopicMapReader(InputStream stream, LocatorIF base_address);
  public  LTMTopicMapReader(File file);

}