private void doImportFromURL(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { URL source = getSourceURL(); IOUtilities.pipe( source.openStream(), new FileOutputStream(new File(getStorageDirectory(), FILE_DATA), true), true, true); completeTransfer(req, resp); }
public EmailContent(String fileName) throws URISyntaxException, IOException { URL entry = GitActivator.getDefault().getBundleContext().getBundle().getEntry(fileName); if (entry == null) throw new IOException("File not found: " + fileName); BufferedReader reader = new BufferedReader(new InputStreamReader(entry.openStream())); String line = null; try { title = reader.readLine(); StringBuilder stringBuilder = new StringBuilder(); String ls = System.getProperty("line.separator"); while ((line = reader.readLine()) != null) { stringBuilder.append(line); stringBuilder.append(ls); } content = stringBuilder.toString(); } finally { reader.close(); } }