Logo Search packages:      
Sourcecode: jlha-utils version File versions  Download package

void org::jlhafrontend::JLHAFrontEnd::del ( Opts  useropts,
String  archiveFilename,
String[]  filesFilename 
) [inline]

execute delete command

Parameters:
useropts Options input by users
archiveFilename the filename of the archive file
filesFilename the array of filenames to be extracted

Definition at line 653 of file JLHAFrontEnd.java.

References mkbackup(), mylogger, and transferBackupToArchive().

Referenced by start().

                                                                                   {
      int i=0;
      File fl=null;
      String backupFilename=null;
      LhaFile backupFile=null;
      LhaOutputStream lio=null;
      Vector deleteFiles=null;

      /* open archive file */
      try {
          fl = (new File(archiveFilename));
      } catch (Exception e) {
          mylogger.warning("Open "+archiveFilename+" error:"+e.toString());
          return;
      }

      /* if the file is not exist, return */
      try {
          if (!fl.exists()) {
            return;
          }
      } catch (Exception e) {
          mylogger.severe("Cannot test exist");
          return;
      }


      /* make backup */
      backupFilename = mkbackup(archiveFilename);

      /* open new archive file */
      try {
          lio = new LhaOutputStream(new FileOutputStream(archiveFilename));
      } catch (Exception e) {
          mylogger.severe("new LhaImeediateOutputStream with "+archiveFilename+" error: "+e.toString());
          return;
      }

      /* open backup file */
      try {
          backupFile = new LhaFile (new File(backupFilename));
      } catch (FileNotFoundException e) {
          System.err.println("LHa: Fatal error: "+archiveFilename+": No such file or directory");
          return;
      } catch (Exception e) {
          mylogger.warning("Open "+archiveFilename+" error:"+e.toString());             System.err.println("LHa: Warning: Checksum error (LHarc file?)");
          System.err.println("LHa: Fatal error: Unkonwn header (lha file?)");
          return;
      }

      deleteFiles = transferBackupToArchive(backupFile,lio,filesFilename);

      /* close files */
      try {
          lio.close();
      } catch (IOException e) {
          mylogger.severe("lio.close() "+e.toString());
      }
      try {
          backupFile.close();
      } catch (IOException e) {
          mylogger.severe("backupFile.close() "+e.toString());
      }

      /* show delete entries */
      for (i=0 ; i<deleteFiles.size() ; i++) {
          System.out.println("delete "+((String)deleteFiles.elementAt(i)));
      }

    }


Generated by  Doxygen 1.6.0   Back to index