// Reading file "myFile" // create a file object and get existing file length File file = new File("/home/jzhuk/","myFile"); int size = (int) file.length(); // allocate array of bytes to read the file byte[] data = new byte[size]; // create a file input stream FileInputStream in = new FileInputStream(file); // prepare a byte counter int bytes_read = 0; // read file input stream into array of bytes bytes_read = in.read(data);
Back to I/O Classes Overview