/** * This is a best attempt to provide a URL.toExternalForm() from * a file URL. Some parsers like Crimson choke on uri that are made of * backslashed paths (ie windows) as it is does not conform * URI specifications. * @param file the file to create the system id from. * @return the systemid corresponding to the given file. * @since Ant 1.5.2 */ public static String getSystemId(File file) { return FILE_UTILS.toURI(file.getAbsolutePath()); }
/** * convert a file to a URL; * * @param fileToConvert File * @return the file converted to a URL */ private String toURL(File fileToConvert) { //create the URL //ant equivalent of fileToConvert.toURI().toURL().toExternalForm(); return FileUtils.getFileUtils().toURI(fileToConvert.getAbsolutePath()); }
sealBase = new URL(FileUtils.getFileUtils().toURI(container.getAbsolutePath())); } catch (MalformedURLException e) {
inputSource.setSystemId(FILE_UTILS.toURI(file.getAbsolutePath())); return inputSource; } catch (IOException fne) {
sealBase = new URL(FileUtils.getFileUtils().toURI(container.getAbsolutePath())); } catch (final MalformedURLException e) {
private String resourceToURI(final Resource resource) { final FileProvider fp = resource.as(FileProvider.class); if (fp != null) { return FILE_UTILS.toURI(fp.getFile().getAbsolutePath()); } final URLProvider up = resource.as(URLProvider.class); if (up != null) { final URL u = up.getURL(); return String.valueOf(u); } else { return resource.getName(); } }
errorHandler.init(afile); InputSource is = new InputSource(Files.newInputStream(afile.toPath())); String uri = FILE_UTILS.toURI(afile.getAbsolutePath()); is.setSystemId(uri); xmlReader.parse(is);
parser = new XMLReaderAdapter(JAXPUtils.getXMLReader()); String uri = FILE_UTILS.toURI(bFile.getAbsolutePath()); inputStream = Files.newInputStream(bFile.toPath()); inputSource = new InputSource(inputStream);
try { InputSource inputSource = new InputSource(Files.newInputStream(file.toPath())); inputSource.setSystemId(FILE_UTILS.toURI(file.getAbsolutePath())); return inputSource; } catch (IOException fne) {
uri = FILE_UTILS.toURI(buildFile.getAbsolutePath()); inputStream = Files.newInputStream(buildFile.toPath()); } else {
sealBase = new URL(FileUtils.getFileUtils().toURI(container.getAbsolutePath())); } catch (MalformedURLException e) {
if (file.length() > 0) { Document testsuiteDoc = builder.parse(FileUtils .getFileUtils().toURI(file.getAbsolutePath())); Element elem = testsuiteDoc.getDocumentElement();
uri = getFileUtils().toURI(buildFile.getAbsolutePath());