/** * Convert the URI to an input stream. * * @param uri * The uri */ public InputStream makeInputStream(URI uri) throws IOException { URI converted = uri; if ((fileProtocol.equals(converted.scheme()) || converted.scheme() == null) && inFilepath != null) { return searchFilePath(converted.toString()); } URL url = createURL(converted.toString()); URLConnection urlConnection = url.openConnection(); return urlConnection.getInputStream(); }
/** * Convert the URI to an output stream. * * @param uri * The uri */ public OutputStream createOutputStream(URI uri) throws IOException { URI converted = uri; if (platformProtocol.equals(converted.scheme())) { URL resolvedURL = resolvePlatform(new URL(converted.toString())); if (resolvedURL != null) { converted = URI.createFileURI(resolvedURL.getFile()); } } if (fileProtocol.equals(converted.scheme()) || converted.scheme() == null) { return openFileOutputStream(converted); } URL url = createURL(converted.toString()); URLConnection urlConnection = url.openConnection(); urlConnection.setDoOutput(true); return urlConnection.getOutputStream(); }