private static File copy(final File file, final File lib) throws IOException { final File dest = new File(lib, file.getName()); if (dest.exists()) { return dest; } IO.copy(file, dest); return dest; }
public static void copy(final File from, final File to) throws IOException { if (!from.isDirectory()) { final FileOutputStream fos = new FileOutputStream(to); try { copy(from, fos); } finally { close(fos); } } else { copyDirectory(from, to); } }
public static String slurp(final InputStream in) throws IOException { final ByteArrayOutputStream out = new ByteArrayOutputStream(); copy(in, out); return new String(out.toByteArray()); }
public static void copy(final File from, final File to) throws IOException { if (!from.isDirectory()) { final FileOutputStream fos = new FileOutputStream(to); try { copy(from, fos); } finally { close(fos); } } else { copyDirectory(from, to); } }
public static void copyFile(File source, File destination) throws IOException { File destinationDir = destination.getParentFile(); if (!destinationDir.exists() && !destinationDir.mkdirs()) { throw new IOException("Cannot create directory : " + destinationDir); } IO.copy(source, destination); }
public static String slurp(final InputStream in) throws IOException { final ByteArrayOutputStream out = new ByteArrayOutputStream(); copy(in, out); return new String(out.toByteArray()); }
public static void copy(File srcFile, File destFile) throws IOException { if (destFile.exists() && destFile.isDirectory()) { throw new IOException("Destination '" + destFile + "' exists but is a directory"); } IO.copy(srcFile, destFile); }
@Override public void init() throws ServletException { super.init(); try (final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("js/livereload.js")) { final ByteArrayOutputStream out = new ByteArrayOutputStream(); IO.copy(is, out); js = out.toByteArray(); } catch (final IOException e) { throw new IllegalStateException("impossible to find livereload.js", e); } } }
private static void copyFile(final File file, final File destFile) throws DeploymentTerminatedException { try { IO.copy(file, destFile); } catch (final Exception e) { throw new DeploymentTerminatedException(messages.format("cmd.deploy.cantCopy", file.getAbsolutePath(), destFile.getAbsolutePath())); } }
private static void copyFile(final File file, final File destFile) throws DeploymentTerminatedException { try { IO.copy(file, destFile); } catch (final Exception e) { throw new DeploymentTerminatedException(messages.format("cmd.deploy.cantCopy", file.getAbsolutePath(), destFile.getAbsolutePath())); } }
public static String copyTryingProxies(final URI source, final File destination) throws Exception { final InputStream is = inputStreamTryingProxies(source); if (is == null) { return null; } try { IO.copy(is, destination); } finally { IO.close(is); } return destination.getAbsolutePath(); }
public static void copy(final File from, final OutputStream to) throws IOException { final InputStream read = read(from); try { copy(read, to); } finally { close(read); } }
public static void copy(final InputStream from, final File to) throws IOException { final OutputStream write = write(to); try { copy(from, write); } finally { close(write); } }
public static void copy(final File from, final OutputStream to) throws IOException { final InputStream read = read(from); try { copy(read, to); } finally { close(read); } }
public static void copy(final URL from, final OutputStream to) throws IOException { final InputStream read = read(from); try { copy(read, to); } finally { close(read); } }
public static void copy(final InputStream from, final File to, final boolean append) throws IOException { final OutputStream write = write(to, append); try { copy(from, write); } finally { close(write); } }
public static void copy(final URL from, final OutputStream to) throws IOException { final InputStream read = read(from); try { copy(read, to); } finally { close(read); } }
public static File createConfig(final File config) throws IOException { final ResourceFinder finder = new ResourceFinder(""); final URL defaultConfig = finder.find("default.openejb.conf"); IO.copy(IO.read(defaultConfig), config); return config; }
public static File createConfig(final File config) throws IOException { final ResourceFinder finder = new ResourceFinder(""); final URL defaultConfig = finder.find("default.openejb.conf"); IO.copy(IO.read(defaultConfig), config); return config; }
private static void updateBinFile(final File binDir, final String binFile, final String changes) throws IOException { final URL agent = getResource(changes); final File catalinaSh = file(binDir, binFile); String content = IO.slurp(catalinaSh); content = content.replace("# ----- Execute The Requested Command", IO.slurp(agent)); IO.copy(IO.read(content), catalinaSh); }