Package java.io

Examples of java.io.File.canWrite()


      throws Exception
   {
      File file = new File(this.dataDir, filename);
     
      if (file.isFile()) {
         if (file.canRead() && file.canWrite()) {
            return file;  // everything fine
         }
         else {
            throw new Exception("file '" + filename + "' is not r/w"); // oops
         }
View Full Code Here


        files[i] = new FtpFile(list[i]);
        File f = new File(getAbsolutePath() + File.separator + list[i]);
        files[i].setSize(f.length());
        String first = (f.isFile()) ? "-" : "d";
        String sec = (f.canRead()) ? "r" : "-";
        String third = (f.canWrite()) ? "w" : "-";
        files[i].setMode(first + sec + third);
        files[i].setFtpMode(false);
        files[i].setAbsolutePath(getAbsolutePath() + File.separator + files[i].getName());
      }
      return files;
View Full Code Here

                            + "\" doesn't exist or can't read");
                    return;
                }

                File targetFile = new File(target);
                if (targetFile.exists() && !targetFile.canWrite()) {
                    System.err.println("Can't write to specified target \""
                            + target + "\"");
                    return;
                }
View Full Code Here

    File file;
    int i, j;
    file = new File(fileName);
    try {
      PrintWriter out = new PrintWriter(new FileOutputStream(file));
      if (!file.canWrite())
        return false;// fail while opening the file
      for (i = 161; i < 255; i++)
        for (j = 161; j < 255; j++)
          out.println("" + i + j + "," + i + "," + j);
      out.close();
View Full Code Here

            }
        }
        if (!queueDir.isDirectory()) {
            throw new ServletException("Message queue directory appears to not be a directory.");
        }
        if (!queueDir.canWrite() || !queueDir.canRead()) {
            throw new ServletException("Message queue directory " + queueDir.getAbsolutePath() + " has incorret permissions.");
        }
        try {
            notifier = new Notifier(queueDir);
        } catch (IOException e2) {
View Full Code Here

        }
    }

    public boolean processSurrogate(final String s) {
        final File infile = new File(this.surrogatesInPath, s);
        if (!infile.exists() || !infile.canWrite() || !infile.canRead()) return false;
        final File outfile = new File(this.surrogatesOutPath, s);
        //if (outfile.exists()) return false;
        boolean moved = false;
        if (s.endsWith("xml.zip")) {
            // open the zip file with all the xml files in it
View Full Code Here

            // first delete all old files
            for (int i = 0; i < 16; i++) {
                ybrName = "YBR-4-" + Digest.encodeHex(i, 2) + ".idx";
                f = new File(rankingPath, ybrName);
                if (!f.exists()) continue;
                if (!f.canWrite()) return;
                f.delete();
            }
            // write new files
            for (int i = 0; i < Math.min(12, ybrTables.length); i++) {
                ybrName = "YBR-4-" + Digest.encodeHex(i, 2) + ".idx";
View Full Code Here

            throwIllegalValueException(val);
        }
        if (attrSpecified(IS_READABLE) && !f.canRead()) {
            throwIllegalValueException(val);
        }
        if (attrSpecified(IS_WRITEABLE) && !f.canWrite()) {
            throwIllegalValueException(val);
        }
    }

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

                throw new IOException(
                        RB.extraction_parent_not_dir.getString(
                        parentDir.getAbsolutePath()));
            }

            if (!parentDir.canWrite()) {
                throw new IOException(
                        RB.extraction_parent_not_writable.getString(
                        parentDir.getAbsolutePath()));
            }
        } else {
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.