Package java.io

Examples of java.io.File.canWrite()


        }

        File parentDir = targetFile.getAbsoluteFile().getParentFile();

        if (parentDir.exists() && parentDir.isDirectory()) {
            if (!parentDir.canWrite()) {
                throw new IOException(RB.cant_write_dir.getString(
                        parentDir.getAbsolutePath()));
            }
        } else {
            throw new IOException(
View Full Code Here


                if (!parentDir.isDirectory()) {
                    throw new IOException(
                        RB.parent_not_dir.getString(parentDir.getPath()));
                }

                if (!parentDir.canWrite()) {
                    throw new IOException(
                        RB.cant_write_parent.getString(parentDir.getPath()));
                }
            } else {
                if (!parentDir.mkdirs()) {
View Full Code Here

            // Datei pruefen
            if (_fileName != null && !_fileName.equals("")) {
                File file = new File(_fileName);
                file.createNewFile();
                if (!file.canWrite()) { throw new FileNotFoundException(
                        "File not writeable: " + _fileName); }

                if (_log != null) _log.debug2("Starte Export in die Datei...");

                SimpleDateFormat dateFormat = new SimpleDateFormat(
View Full Code Here

    // wenn Datei noch nicht exisitert => executeZip() ausf�hren
    if ( !file.exists() ) {
      this.executeZip();
      return;
     
    } else if ( !file.canWrite() ) {
      try {
        throw new Exception("cannot write "+file.getCanonicalPath());
      } catch (Exception e) {
        throw new Exception("cannot write "+this.targetPath);
      }
View Full Code Here

            file = new File(this.targetPath);
           
            if ( !file.isDirectory() ) {
              throw new Exception(this.targetPath +" is no directory");
            } else {
              if ( !file.canWrite() )
                throw new Exception(this.targetPath +" is not writable");
            }
           
          // Zielpfad normalisieren
            this.targetPath = this.targetPath.replaceAll("\\\\", "/");
View Full Code Here

                        if ( cleanupAttachment ) {
                         
                            for(int i=0; i<attachments.length; i++) {
                              File attachmentFile = new File(attachments[i]);
                              if ( attachmentFile.exists() && attachmentFile.canWrite() ) {
                                SOSFile.deleteFile( attachmentFile );
                              }
                            }
                        }
               
View Full Code Here

   * @throws RecorderException if a problem occurred while writing home.
   */
  public void writeHome(Home home, String name) throws RecorderException {
    File homeFile = new File(name);
    if (homeFile.exists()
        && !homeFile.canWrite()) {
      throw new RecorderException("Can't write over file " + name);
    }
   
    DefaultHomeOutputStream homeOut = null;
    File tempFile = null;
View Full Code Here

          Vector deleteFilelist = SOSFile.getFilelist(filePath, deleteFileSpec, 0);
          Iterator deleteIterator = deleteFilelist.iterator();
          while(deleteIterator.hasNext()) {
            File tempFile = (File)deleteIterator.next();
            long interval = System.currentTimeMillis()-tempFile.lastModified();
            if (tempFile.canWrite()  && interval>(deleteFileAge*24*3600*1000) ) {
              try {               
                  tempFile.delete();
                  spooler_log.debug1( ".. log file [" + tempFile.getName() +
                  "] deleted.");             
                  deleteCounter++;
View Full Code Here

        Vector filelist = SOSFile.getFilelist(spooler.log_dir(), fileSpec, 0);
        Iterator iterator = filelist.iterator();
        while(iterator.hasNext()) {
          File tempFile = (File)iterator.next();
          long interval = System.currentTimeMillis()-tempFile.lastModified();
          if (tempFile.canWrite() && interval > (fileAge*24*3600*1000) ) {
            try {             
              counter++;
              String gzipFilename = filePath + tempFile.getName().concat(".gz");
              File gzipFile = new File(gzipFilename);
              SOSGZip.compressFile(tempFile, gzipFile);
View Full Code Here

        if (fleF.exists()) {
        }
        else {
          fleF.createNewFile();
        }
        if (fleF.canWrite()) {
          // nothing to do
        }
        else {
          strT = String.format("%2$s: File '%1$s'. canWrite returns false. Check permissions.", pstrFileName, pstrMethodName);
          strT += fleF.toString();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.