private static void readObjectFile(Path path){
     ObjectInputStream dataIn=null;
        try {
        //apertura del stream
        dataIn= new ObjectInputStream(Files.newInputStream(path));
        try{
            while (true){
                //lectura de objetos (thorws ClassNotFoundException):
                Product product = (Product) dataIn.readObject();
                System.out.println(product.toString());
            }
        }catch (EOFException ex){System.out.println("Fin de fichero detectado");}
        }catch (IOException ex) {
            System.err.println("Error I/O "+ex);
        }catch (ClassNotFoundException ex) {
            System.err.println("Error clase no encontrada "+ex);
        }finally{
             //Se cierra el stream y se liberan los recursos de sistema asociados a él.
            if (dataIn!=null)
            try{
                dataIn.close();
            }catch (IOException ex) {
                System.err.println("Error I/O "+ex);
            } 
        }
     }