Package java.io

Examples of java.io.File.canRead()


   * 加载用户定义配置,默认存放在程序启动目录
   */
  private static void loadUserConfig()
  {
    File file = new File("maplefetion.properties");
    if(file.exists()&&file.canRead()) {
      try {
        System.out.println("found user specified maplefetion.properties..");
              loadConfig(file);
            } catch (IOException e) {
              //忽略掉
View Full Code Here


     try {
        URL fileURL = new URL(targetDir);

        File file = new File(fileURL.getFile());

        if(file.isDirectory() && file.canRead() && file.canWrite()) {
           dir = file;
        }
     }
     catch(Exception e) {
       // Otherwise, try to see inside the jboss directory hierarchy
View Full Code Here

      File[] dirs = basedir.listFiles(dirFilter);

      for (int i = 0; i < dirs.length; i++) {
         File file = new File(dirs[i], TEMPLATE_CONFIG_FILE);

         if (file.isFile() && file.canRead())
            files.add(file);
      }
      return files;
   }
View Full Code Here

      for (int i = 0; i < files.length; i++)
      {
         File source = files[i];

         if (!source.canRead())
            throw new IOException("cannot read: " + source);

         if (source.isFile())
            Files.copy(source, new File(targetDir, source.getName()));
         else
View Full Code Here

    try {
       URL fileURL = new URL(baseDir);
       
       File file = new File(fileURL.getFile());
       
       if(file.isDirectory() && file.canRead() && file.canWrite()) {
          dir = file;
       }
    }
    catch(Exception e) {
     // Otherwise, try to make it inside the jboss directory hierarchy
View Full Code Here

      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

      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

      for (int i = 0; i < files.length; i++) {
        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());
      }
View Full Code Here

                    textComp.setCaretPosition(textComp.getText().length());
                }
                if (pressed == '\n') {
                    System.out.println("Enter");
                    File tmp = new File(getText());
                    if (tmp.exists() && tmp.isDirectory() && tmp.canRead()) {
                        ((JTextComponent) getEditor().getEditorComponent())
                                .setCaretPosition(getText().length());
                        setAndSelectDirectory(tmp);
                    }
                }
View Full Code Here

                    return;
                }

                // Check the source and the target.
                File sourceFile = new File(source);
                if (!sourceFile.exists() || !sourceFile.canRead()) {
                    System.err.println("Source file \"" + source
                            + "\" doesn't exist or can't read");
                    return;
                }
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.