/** * Copies the contents a resource to the given <var>toFile</var>. * <p> * The resource is addressed by the <var>clasS</var> and the <var>resourceName</var>, as described for {@link * Class#getResourceAsStream(String)}. * </p> * * @param createMissingParentDirectories Whether to create any missing parent directories for the <var>toFile</var> */ public static void copyResource( final Class<?> clasS, final String resourceName, File toFile, boolean createMissingParentDirectories ) throws IOException { IoUtil.outputFileOutputStream( toFile, new ConsumerWhichThrows<OutputStream, IOException>() { @Override public void consume(OutputStream outputStream) throws IOException { IoUtil.copyResource(clasS, resourceName, outputStream, false); } }, createMissingParentDirectories ); }
/** * Copies the contents a resource to the given <var>toFile</var>. * <p> * The resource is addressed by the <var>classLoader</var> and the <var>resourceName</var>, as described for * {@link ClassLoader#getResourceAsStream(String)}. * </p> * * @param createMissingParentDirectories Whether to create any missing parent directories for the <var>toFile</var> */ public static void copyResource( final ClassLoader classLoader, final String resourceName, File toFile, boolean createMissingParentDirectories ) throws IOException { IoUtil.outputFileOutputStream( toFile, new ConsumerWhichThrows<OutputStream, IOException>() { @Override public void consume(OutputStream outputStream) throws IOException { IoUtil.copyResource(classLoader, resourceName, outputStream, false); } }, createMissingParentDirectories ); }
/** * Copies the contents a resource to the given <var>toFile</var>. * <p> * The resource is addressed by the <var>classLoader</var> and the <var>resourceName</var>, as described for * {@link ClassLoader#getResourceAsStream(String)}. * </p> * * @param resourceName Must not start with a "/" * @param createMissingParentDirectories Whether to create any missing parent directories for the <var>toFile</var> */ public static void copyResource( final ClassLoader classLoader, final String resourceName, File toFile, boolean createMissingParentDirectories ) throws IOException { IoUtil.outputFileOutputStream( toFile, new ConsumerWhichThrows<OutputStream, IOException>() { @Override public void consume(OutputStream outputStream) throws IOException { IoUtil.copyResource(classLoader, resourceName, outputStream, false); } }, createMissingParentDirectories ); }
/** * Copies the contents a resource to the given <var>toFile</var>. * <p> * The resource is addressed by the <var>clasS</var> and the <var>resourceName</var>, as described for {@link * Class#getResourceAsStream(String)}. * </p> * * @param resourceName Must not start with a "/" * @param createMissingParentDirectories Whether to create any missing parent directories for the <var>toFile</var> */ public static void copyResource( final Class<?> clasS, final String resourceName, File toFile, boolean createMissingParentDirectories ) throws IOException { IoUtil.outputFileOutputStream( toFile, new ConsumerWhichThrows<OutputStream, IOException>() { @Override public void consume(OutputStream outputStream) throws IOException { IoUtil.copyResource(clasS, resourceName, outputStream, false); } }, createMissingParentDirectories ); }
IoUtil.outputFileOutputStream( file, new ConsumerWhichThrows<OutputStream, EX>() {
IoUtil.outputFileOutputStream( file, new ConsumerWhichThrows<OutputStream, EX>() {