Here you can find the source of copyFile(InputStream from, Path to)
public static void copyFile(InputStream from, Path to) throws IOException
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; public class Main { public static void copyFile(InputStream from, Path to) throws IOException { Files.copy(from, to, StandardCopyOption.REPLACE_EXISTING); }/*w ww .ja v a2 s . co m*/ }