private static void writeByteFile(Path path){
     DataOutputStream dataOut=null;
        try {
            //apertura del stream. StandardOpenOption.CREATE->si el fichero no existe se crea
            dataOut = new DataOutputStream(Files.newOutputStream(path, java.nio.file.StandardOpenOption.CREATE));
            for (int i=0; i<Data.COD.length;i++){
                //escritura de bytes (thorws IOException): 
                dataOut.writeUTF(Data.COD[i]);
                dataOut.writeUTF(Data.DESC[i]);
                dataOut.writeInt(Data.STOCK[i]);
                dataOut.writeDouble(Data.PRICE[i]);}
            System.out.println("Escritura fichero "+path.getFileName().toString()+ "finalizada");
            readByteFile(path);
        } catch (IOException ex) {
            System.err.println("Error I/O "+ex);
        }finally{
            //Se cierra el stream y se liberan los recursos de sistema asociados a él.
            if (dataOut!=null)
            try{
                dataOut.close();
            }catch (IOException ex) {
                System.err.println("Error I/O "+ex);
            } 
        }
     }