Java Path File Name nio writeDataFile(final String resourceName, final Path sourcePath)

Here you can find the source of writeDataFile(final String resourceName, final Path sourcePath)

Description

write Data File

License

Apache License

Declaration

public static void writeDataFile(final String resourceName,
            final Path sourcePath) throws IOException, URISyntaxException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
import static java.lang.Thread.currentThread;
import static java.nio.file.Files.copy;

public class Main {
    public static void writeDataFile(final String resourceName,
            final Path sourcePath) throws IOException, URISyntaxException {
        copy(Paths.get(currentThread().getContextClassLoader()
                .getResource(resourceName).toURI()), new FileOutputStream(
                sourcePath.toFile(), false));
    }/*  w  w w  . j  ava  2  s .co m*/
}

Related

  1. toResourcePath(String fileName)
  2. unzipFile(String fileName, String targetPath)
  3. uploadFileToServer(InputStream input, String filename, String usercode, String basePath)
  4. validateDockerfilePath(String name)
  5. which(Path path, String name)
  6. writeFile(String pathname, String data)
  7. writeFileFromInputStream(String the_path, String the_filename, InputStream the_sis)