private byte[] readFileContents(Path.Entry<?> file) throws IOException {
		InputStream in = file.inputStream();
		ByteArrayOutputStream buffer = new ByteArrayOutputStream();
		int nRead;
		// Read bytes in max 1024 chunks
		byte[] data = new byte[1024];
		// Read all bytes from the input stream
		while ((nRead = in.read(data, 0, data.length)) != -1) {
			buffer.write(data, 0, nRead);
		}
		// Done
		buffer.flush();
		return buffer.toByteArray();
	}
private byte[] readFileContents(Path.Entry<?> file) throws IOException {
		InputStream in = file.inputStream();
		ByteArrayOutputStream buffer = new ByteArrayOutputStream();
		int nRead;
		
		byte[] data = new byte[1024];
		
		while ((nRead = in.read(data, 0, data.length)) != -1) {
			buffer.write(data, 0, nRead);
		}
		
		buffer.flush();
		return buffer.toByteArray();
	}
private byte [ ] readFileContents ( Path . Entry < ? > file ) throws IOException { InputStream in = file . inputStream ( ) ; ByteArrayOutputStream buffer = new ByteArrayOutputStream ( ) ; int nRead ; // Read bytes in max 1024 chunks byte [ ] data = new byte [ 1024 ] ; // Read all bytes from the input stream while ( ( nRead = in . read ( data , 0 , data . length ) ) != - 1 ) { buffer . write ( data , 0 , nRead ) ; } // Done buffer . flush ( ) ; return buffer . toByteArray ( ) ; }
Read the contents of a given file into a byte array.

@param file
@return
@throws IOException
Read the contents of a given file into a byte array .