/**
* @(#)ExempleReadAllBytes.java
*
*
* @author
*sakoba(java.mesexemples.com) @version 1.00 2012/12/11
*/
import java.nio.file.*;
import java.nio.*;
public class ExempleReadAllBytes {
public static void main(String[] args) throws Exception
{
Path path = Paths.get("c:/test.txt");
// Lire les octets du fichier
byte[] contenu = Files.readAllBytes(path);
// Parcourir les octets et afficher les caractères correspondants
for (byte b : contenu)
{
System.out.print((char)b);
}
}
}