Java examples for File Path IO:File Operation
Save byte array to a file
import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void main(String[] args) { Path ball_path = Paths.get("C:/folder1/photos", "ball.png"); try {/* w w w. j a v a 2s. co m*/ byte[] ballArray = Files.readAllBytes(ball_path); Files.write(ball_path.resolveSibling("bytes_to_ball.png"), ballArray); } catch (IOException e) { System.out.println(e); } } }