Package java.io

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


    }

    // 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

            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

            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

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

      try {
         FileInputStream fis = new FileInputStream(entryName);
         return fis;
View Full Code Here

                            optCacheLoc = optCacheLoc.substring(1);
                        }
                    }

                    File cacheDir = new File(optCacheLoc);
                    if (cacheDir.exists() && cacheDir.canWrite()) {
                        preindexCacheLocation = optCacheLoc;
                        if (!preindexCacheLocation.endsWith("/") &&
                            !preindexCacheLocation.endsWith(File.separator)) {
                            preindexCacheLocation += File.separator;
                        }
View Full Code Here

      }
      if (!pp.isDirectory()) {
         log.severe(path + " is no directory, please specify another 'Persistence.Path' in xmlBlaster.properties");
         throw new XmlBlasterException(glob, ErrorCode.RESOURCE_CONFIGURATION, ME, path + " is no directory, please specify another 'Persistence.Path' in xmlBlaster.properties");
      }
      if (!pp.canWrite()) {
         log.severe("Sorry, no access permissions to " + path + ", please specify another 'Persistence.Path' in xmlBlaster.properties");
         throw new XmlBlasterException(glob, ErrorCode.RESOURCE_CONFIGURATION, ME, "Sorry, no access permissions to " + path + ", please specify another 'Persistence.Path' in xmlBlaster.properties");
      }
   }
View Full Code Here

            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

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

      try {
         int toRead = (int)info.getSize();
         int offset = 0;
View Full Code Here

         }
         if (tmp == null)
            throw new Exception("Directory '" + subDir + "' not found as subdirectory of '" + directory.getAbsolutePath() + "'");
         if (!tmp.isDirectory())
            throw new Exception("File '" + subDir + "' in '" + directory.getAbsolutePath() + "' is not a directory");
         if (!tmp.canWrite())
            throw new Exception("Can not write in directory '" + subDir + "' in '" + directory.getAbsolutePath() + "'.");
        
         for (int i=0; i < list.size(); i++) {
            tmp = new File(tmp, (String)list.get(i));
            tmp.mkdir();
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.