/** * Gets an InputSource from a string, which contains either * a file name or an URL. */ public static InputSource getInputSource(String fileOrURL) { try { Object o = getFileOrURL(fileOrURL); if(o instanceof URL) { return new InputSource(escapeSpace(((URL)o).toExternalForm())); } else { String url = ((File)o).toURL().toExternalForm(); return new InputSource(escapeSpace(url)); } } catch (IOException e) { return new InputSource(fileOrURL); } }
/** * Converts an URL to an InputSource. */ private InputSource getInputSource( URL url ) { return Util.getInputSource(url.toExternalForm()); }
private InputSource fileToInputSource(File source) { try { String url = source.toURL().toExternalForm(); return new InputSource(Util.escapeSpace(url)); } catch (MalformedURLException e) { return new InputSource(source.getPath()); } }
private InputSource fileToInputSource(File source) { try { String url = source.toURL().toExternalForm(); return new InputSource(Util.escapeSpace(url)); } catch (MalformedURLException e) { return new InputSource(source.getPath()); } }
/** * Gets an InputSource from a string, which contains either * a file name or an URL. */ public static InputSource getInputSource(String fileOrURL) { try { Object o = getFileOrURL(fileOrURL); if(o instanceof URL) { return new InputSource(escapeSpace(((URL)o).toExternalForm())); } else { String url = ((File)o).toURL().toExternalForm(); return new InputSource(escapeSpace(url)); } } catch (IOException e) { return new InputSource(fileOrURL); } }
private InputSource fileToInputSource( File source ) { try { String url = source.toURL().toExternalForm(); return new InputSource(Util.escapeSpace(url)); } catch (MalformedURLException e) { return new InputSource(source.getPath()); } }
/** * Converts an URL to an InputSource. */ private InputSource getInputSource(URL url) { return Util.getInputSource(url.toExternalForm()); }
/** * Gets an InputSource from a string, which contains either * a file name or an URL. */ public static InputSource getInputSource(String fileOrURL) { try { Object o = getFileOrURL(fileOrURL); if(o instanceof URL) { return new InputSource(escapeSpace(((URL)o).toExternalForm())); } else { String url = ((File)o).toURL().toExternalForm(); return new InputSource(escapeSpace(url)); } } catch (IOException e) { return new InputSource(fileOrURL); } }
private InputSource fileToInputSource(File source) { try { String url = source.toURL().toExternalForm(); return new InputSource(Util.escapeSpace(url)); } catch (MalformedURLException e) { return new InputSource(source.getPath()); } }
/** * Converts an URL to an InputSource. */ private InputSource getInputSource(URL url) { return Util.getInputSource(url.toExternalForm()); }
/** * Gets an InputSource from a string, which contains either * a file name or an URL. */ public static InputSource getInputSource(String fileOrURL) { try { Object o = getFileOrURL(fileOrURL); if(o instanceof URL) { return new InputSource(escapeSpace(((URL)o).toExternalForm())); } else { String url = ((File)o).toURL().toExternalForm(); return new InputSource(escapeSpace(url)); } } catch (IOException e) { return new InputSource(fileOrURL); } }
private InputSource fileToInputSource(File source) { try { String url = source.toURL().toExternalForm(); return new InputSource(Util.escapeSpace(url)); } catch (MalformedURLException e) { return new InputSource(source.getPath()); } }
/** * Converts an URL to an InputSource. */ private InputSource getInputSource(URL url) { return Util.getInputSource(url.toExternalForm()); }
/** * Gets an InputSource from a string, which contains either * a file name or an URL. */ public static InputSource getInputSource(String fileOrURL) { try { Object o = getFileOrURL(fileOrURL); if(o instanceof URL) { return new InputSource(escapeSpace(((URL)o).toExternalForm())); } else { String url = ((File)o).toURL().toExternalForm(); return new InputSource(escapeSpace(url)); } } catch (IOException e) { return new InputSource(fileOrURL); } }
private InputSource fileToInputSource(File source) { try { String url = source.toURL().toExternalForm(); return new InputSource(Util.escapeSpace(url)); } catch (MalformedURLException e) { return new InputSource(source.getPath()); } }
/** * Converts an URL to an InputSource. */ private InputSource getInputSource( URL url ) { return Util.getInputSource(url.toExternalForm()); }
/** * Parses a token to a file (or a set of files) * and add them as {@link InputSource} to the specified list. * * @param suffix If the given token is a directory name, we do a recusive search * and find all files that have the given suffix. */ private void addFile(String name, List<InputSource> target, String suffix) throws BadCommandLineException { Object src; try { src = Util.getFileOrURL(name); } catch (IOException e) { throw new BadCommandLineException(WscompileMessages.WSIMPORT_NOT_A_FILE_NOR_URL(name)); } if (src instanceof URL) { target.add(absolutize(new InputSource(Util.escapeSpace(((URL) src).toExternalForm())))); } else { File fsrc = (File) src; if (fsrc.isDirectory()) { addRecursive(fsrc, suffix, target); } else { target.add(absolutize(fileToInputSource(fsrc))); } } }
private InputSource fileToInputSource( File source ) { try { String url = source.toURL().toExternalForm(); return new InputSource(Util.escapeSpace(url)); } catch (MalformedURLException e) { return new InputSource(source.getPath()); } }
/** * Parses a token to a file (or a set of files) * and add them as {@link InputSource} to the specified list. * * @param suffix If the given token is a directory name, we do a recusive search * and find all files that have the given suffix. */ private void addFile(String name, List<InputSource> target, String suffix) throws BadCommandLineException { Object src; try { src = Util.getFileOrURL(name); } catch (IOException e) { throw new BadCommandLineException(WscompileMessages.WSIMPORT_NOT_A_FILE_NOR_URL(name)); } if (src instanceof URL) { target.add(absolutize(new InputSource(Util.escapeSpace(((URL) src).toExternalForm())))); } else { File fsrc = (File) src; if (fsrc.isDirectory()) { addRecursive(fsrc, suffix, target); } else { target.add(absolutize(fileToInputSource(fsrc))); } } }
private InputSource fileToInputSource(File source) { try { String url = source.toURL().toExternalForm(); return new InputSource(Util.escapeSpace(url)); } catch (MalformedURLException e) { return new InputSource(source.getPath()); } }