@Test public void testReadFromFile() throws IOException { TopicMapIF tm = new CTMTopicMapReader(file).read(); Assert.assertNotNull(tm); Assert.assertEquals(1, tm.getTopics().size()); }
@Override protected TopicMapIF read(TopicMapStoreFactoryIF store_factory) throws IOException { TopicMapStoreIF store = store_factory.createStore(); TopicMapIF topicmap = store.getTopicMap(); 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 CTMEncodingSniffer())) { CTMLexer lexer = new CTMLexer(reader); lexer.setDocuri(getBaseAddress().getAddress()); CTMParser parser = new CTMParser(lexer); parser.setBase(getBaseAddress()); parser.setTopicMap(topicmap, null); 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?"); } ClassInstanceUtils.resolveAssociations2(topicmap); return topicmap; }
CTMTopicMapReader extends AbstractTopicMapReader { @Override protected TopicMapIF read(TopicMapStoreFactoryIF store_factory) throws IOException { TopicMapStoreIF store = store_factory.createStore(); TopicMapIF topicmap = store.getTopicMap(); 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 CTMEncodingSniffer())) { CTMLexer lexer = new CTMLexer(reader); lexer.setDocuri(getBaseAddress().getAddress()); CTMParser parser = new CTMParser(lexer); parser.setBase(getBaseAddress()); parser.setTopicMap(topicmap, null); 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?"); } ClassInstanceUtils.resolveAssociations2(topicmap); return topicmap; } }
CTMTopicMapReader extends AbstractTopicMapReader { @Override protected TopicMapIF read(TopicMapStoreFactoryIF store_factory) throws IOException { TopicMapStoreIF store = store_factory.createStore(); TopicMapIF topicmap = store.getTopicMap(); 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 CTMEncodingSniffer())) { CTMLexer lexer = new CTMLexer(reader); lexer.setDocuri(getBaseAddress().getAddress()); CTMParser parser = new CTMParser(lexer); parser.setBase(getBaseAddress()); parser.setTopicMap(topicmap, null); 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?"); } ClassInstanceUtils.resolveAssociations2(topicmap); return topicmap; } CTMTopicMapReader(URL url);  CTMTopicMapReader(URL url, LocatorIF base_address);  CTMTopicMapReader(Reader reader, LocatorIF base_address);  CTMTopicMapReader(InputStream stream, LocatorIF base_address);  CTMTopicMapReader(File file); }
CTMTopicMapReader extends AbstractTopicMapReader { @Override protected TopicMapIF read(TopicMapStoreFactoryIF store_factory) throws IOException { TopicMapStoreIF store = store_factory.createStore(); TopicMapIF topicmap = store.getTopicMap(); 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 CTMEncodingSniffer())) { CTMLexer lexer = new CTMLexer(reader); lexer.setDocuri(getBaseAddress().getAddress()); CTMParser parser = new CTMParser(lexer); parser.setBase(getBaseAddress()); parser.setTopicMap(topicmap, null); 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?"); } ClassInstanceUtils.resolveAssociations2(topicmap); return topicmap; } CTMTopicMapReader(URL url);  CTMTopicMapReader(URL url, LocatorIF base_address);  CTMTopicMapReader(Reader reader, LocatorIF base_address);  CTMTopicMapReader(InputStream stream, LocatorIF base_address);  CTMTopicMapReader(File file);  }
CTMTopicMapReader extends AbstractTopicMapReader { @Override protected TopicMapIF read(TopicMapStoreFactoryIF store_factory) throws IOException { TopicMapStoreIF store = store_factory.createStore(); TopicMapIF topicmap = store.getTopicMap(); 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 CTMEncodingSniffer())) { CTMLexer lexer = new CTMLexer(reader); lexer.setDocuri(getBaseAddress().getAddress()); CTMParser parser = new CTMParser(lexer); parser.setBase(getBaseAddress()); parser.setTopicMap(topicmap, null); 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?"); } ClassInstanceUtils.resolveAssociations2(topicmap); return topicmap; } CTMTopicMapReader(URL url);  CTMTopicMapReader(URL url, LocatorIF base_address);  CTMTopicMapReader(Reader reader, LocatorIF base_address);  CTMTopicMapReader(InputStream stream, LocatorIF base_address);  CTMTopicMapReader(File file);   }