/** * List all the strings specified by the index file passed in. To be * acceptable it must be a non-0 length string, not commented with #, and * not the index file itself. * * @param index the URI to list * @return the list. * @throws IOException a problem with I/O happened */ public static String[] listByIndexFile(URI index) throws IOException { return listByIndexFile(index, new DefaultURIFilter()); }
/** * Get a list of the supported translations */ private void loadSupportedTranslations() { if (translations == null) { try { URL index = ResourceUtil.getResource(Translations.class, "translations.txt"); translations = NetUtil.listByIndexFile(NetUtil.toURI(index)); } catch (IOException ex) { translations = new String[0]; } } }
try { URI search = NetUtil.lengthenURI(uri, INDEX_FILE); reply = listByIndexFile(search, filter); } catch (FileNotFoundException ex) {
/** * Get a list of the available readings sets * * @return all the installed reading sets */ public String[] getInstalledReadingsSets() { try { URL index = ResourceUtil.getResource(ReadingsBookDriver.class, "readings.txt"); return NetUtil.listByIndexFile(NetUtil.toURI(index), new ReadingsFilter()); } catch (IOException ex) { return new String[0]; } }
/** * Get an array of the available style names for a given subject. Different * subjects are available for different contexts. For example - for * insertion into a web page we might want to use a set that had complex * HTML, or IE/NS specific HTML, where as a JFC HTMLDocument needs simpler * HTML - and special tags like the starting <HTML> tags. * <p> * If the protocol of the URL of the current directory is not file then we * can't use File.list to get the contents of the directory. This will * happen if this is being run as an applet. When we start doing that then * we will need to think up something smarter here. Until then we just * return a zero length array. * * @return An array of available style names */ public String[] getStyles() { try { URL index = ResourceUtil.getResource(NetUtil.INDEX_FILE); return NetUtil.listByIndexFile(NetUtil.toURI(index), new XSLTFilter()); } catch (IOException ex) { return new String[0]; } }