Examples of canWrite()


Examples of java.io.File.canWrite()

        if(file.exists()) {
            if(!file.delete()) {
                throw new DbException("Could not delete symbol file: " + file.getAbsolutePath());
            }
        }
        if(file.canWrite()) {
            throw new IllegalStateException("Does not have write permission for "
                    + file.getAbsolutePath());
        }
        try {
            ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file));
View Full Code Here

Examples of java.io.File.canWrite()

        properties.setProperty(key, value);
      }
    }

    final File target = new File(baseDirectory, configPath);
    if (target.exists() == true && target.canWrite() == false)
    {
      return;
    }
    try
    {
View Full Code Here

Examples of java.io.File.canWrite()

      }
    }
    else
    {
      if (baseDirectoryFile.canRead() == false ||
          baseDirectoryFile.canWrite() == false)
      {
        throw new ModuleInitializeException
            ("Unable to access the specified directory."); //$NON-NLS-1$
      }
    }
View Full Code Here

Examples of java.io.File.canWrite()

    * @return null if not found
    */
   public static String directoryForWrite(String path) {
      if (path == null) return null;
      File file = new File(path);
      if (file.isDirectory() && file.canWrite()) {
         return path;
      }
      if (file.getParentFile() == null) return null;
      String parent = file.getParentFile().getAbsolutePath();
      if (parent == null) return null;
View Full Code Here

Examples of java.io.File.canWrite()

           
            try {
                if(!oFile.exists()){
                    oFile.createNewFile();
                }
                if (oFile.canWrite()) {
                    outWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(oFile)));
                }
            } catch (FileNotFoundException e) {
                //Use logger to track SEVERE message.
                logger.log(Level.WARNING, "Can not find file " + outputFile + ", print outputs to void.", e);
View Full Code Here

Examples of java.io.File.canWrite()

            File eFile = new File(errFile);
            try {
                if(!eFile.exists()){
                    eFile.createNewFile();
                }
                if (eFile.canWrite()) {
                    errWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(eFile)));
                }
            } catch (FileNotFoundException e) {
                //Use logger to track SEVERE message.
                logger.log(Level.WARNING, "Can not find file " + errFile + ", print errors to void.", e);
View Full Code Here

Examples of java.io.File.canWrite()

            Constants.LAYER_TECHNICAL,
            Constants.PACKAGE_TECHNICAL_FILE, "30", params);
      }

      // 3. check write permissions
      if (!srcFile.canWrite())
      {
        List params = new Vector();
        params.add(fileName);
        throw new XException(Constants.LOCATION_EXTERN,
            Constants.LAYER_TECHNICAL,
View Full Code Here

Examples of java.io.File.canWrite()

    }

    // 3. resolution: Rename and Delete will take in account
    return mConfiguration.getResolution().equals(Constants.READ_PRESERVE)
        ? true
        : readFile.canWrite();
  }

  /**
   * Reads entire contents of a file into a String.
   * <p>
 
View Full Code Here

Examples of java.io.File.canWrite()

            Constants.LAYER_TECHNICAL,
            Constants.PACKAGE_TECHNICAL_FILE, "30", params);
      }

      // 3. check write permissions
      if (!srcFile.canWrite())
      {
        List params = new Vector();
        params.add(fileName);
        throw new XException(Constants.LOCATION_EXTERN,
            Constants.LAYER_TECHNICAL,
View Full Code Here

Examples of java.io.File.canWrite()

            return;
         }
        
         if (file.isDirectory())
            throw new XmlBlasterException(this.global, ErrorCode.RESOURCE_FILEIO, ME + ".removeEntry", "'" + entryName + "' is a directory");
         if (!file.canWrite())
            throw new XmlBlasterException(this.global, ErrorCode.RESOURCE_FILEIO, ME + ".removeEntry", "no rights to write to '" + entryName + "'");

         if (success && this.sentDirectory == null || !success && this.discardedDirectory == null) {
            if  (deleteFile(file)) {
               this.directoryEntries.remove(entryName);
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.