Java examples for File Path IO:File Operation
Reading a Small File with the readAllBytes() Method
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 {/*from www. ja v a 2 s.co m*/ byte[] ballArray = Files.readAllBytes(ball_path); } catch (IOException e) { System.out.println(e); } } }