import java.io.*; public class Ecriture { private byte[] tabHeader; private String[] tabOffSet; private String filePath; public Ecriture(byte[] tabBytes, String[] tabOctetsBinaires, String chemin) { this.tabHeader = tabBytes; this.tabOffSet = tabOctetsBinaires; this.filePath = chemin; FileOutputStream fichierSortie = null; try { fichierSortie = new FileOutputStream(this.filePath); // Ecriture du tableau de bytes dans le fichier fichierSortie.write(tabBytes); // Ecriture du tableau d'octets binaires dans le fichier for (String flags : this.tabOffSet) { fichierSortie.write((byte) Integer.parseInt(flags, 2)); } } catch (IOException e) { e.printStackTrace(); } finally { // Fermeture du fichier if (fichierSortie != null) { try { fichierSortie.close(); } catch (IOException e) { e.printStackTrace(); } } } } }