Package java.io

Examples of java.io.FilePermission


    harness.check(dir.mkdir() || dir.exists(), "temp directory");
   
    File file = new File(dir, "file");
    String path = file.getPath();

    Permission rperm = new FilePermission(path, "read");
    Permission wperm = new FilePermission(path, "write");
    Permission fdPerm = new RuntimePermission("writeFileDescriptor");
   
    TestSecurityManager sm = new TestSecurityManager(harness);
    try {
      sm.install();
View Full Code Here


                perms.add(new SocketPermission(host, "connect,accept"));
              }
              else if ( "file".equals(codesource.getLocation().getProtocol()) ) {
                // if running locally add file permission
                String path = codesource.getLocation().getFile().replace('/', File.separatorChar);
                  perms.add(new FilePermission(path, "read"));
              }

            } catch (Exception e) {
          e.printStackTrace();
        }
View Full Code Here

         *    the qa1-loader-pref.jar file  passing the 'read' action.
         */
        String path = Util.getJarsDir(config);
        String qa1path = path + "/" + Util.QAJarFile;
        String jarpath = path + "/" + Util.PREFERREDJarFile;
        qa1filePermission = new FilePermission(qa1path, "read");
        jarfilePermission = new FilePermission(jarpath, "read");
        String annotation = super.annotation;
        testCase(true, null);
        testCase(true, annotation);
        testCase(false, null);
        testCase(false, annotation);
View Full Code Here

        /*
         * Create three FilePermissions with "read", "write" and
         * "read,write" actions for the same file.
         */
        FilePermission fp01 = new FilePermission("foo", "read");
        FilePermission fp02 = new FilePermission("foo", "write");
        FilePermission fp03 = new FilePermission("foo", "read,write");

        /*
         * Create three GrantPermissions passing created FilePermissions
         * with "read", "write" and "read,write" actions.
         */
 
View Full Code Here

  for (int i = 0; st.hasMoreTokens(); i++) {
      String dir = st.nextToken();
      if (!dir.endsWith(File.separator))
    dir = dir + File.separatorChar;
      dirs[i] = dir;
      perms[i] = new FilePermission(dir + '-', "read");
  }
  this.verbose = verbose;
  this.stoppable = stoppable;
  this.lifeCycle = lifeCycle;
  server = new ServerSocket(port);
View Full Code Here

      if ('/' != File.separatorChar) {
    path = path.replace('/', File.separatorChar);
      }
      for (int i = 0; i < dirs.length; i++) {
    File f = new File(dirs[i] + path);
    if (perms[i].implies(new FilePermission(f.getPath(), "read")))
    {
        try {
      return getBytes(new FileInputStream(f), f.length());
        } catch (FileNotFoundException e) {
        }
View Full Code Here

      if (endIndex != -1) {
          path = path.substring(0, endIndex+1);
          if (path.endsWith(File.separator)) {
        path += "-";
          }
          Permission p2 = new FilePermission(path, "read");
          if (!perms.implies(p2)) {
        perms.add(p2);
          }
      } else {
          /*
 
View Full Code Here

      }
  } catch (MalformedURLException me) {
      uncanonicalPath = policy;
  }

        policyPermission = new FilePermission(uncanonicalPath, "read");
    }
View Full Code Here

            if (File.separatorChar != '/') {
                path = path.replace('/', File.separatorChar);
            }
            if (isDirectory(u)) {
                pc.add(new FilePermission(path + "-", "read")); //$NON-NLS-1$ //$NON-NLS-2$
            } else {
                pc.add(new FilePermission(path, "read")); //$NON-NLS-1$
            }
        } else {
            String host = u.getHost();
            if (host.length() == 0) {
                host = "localhost"; //$NON-NLS-1$
View Full Code Here

    _dependencies.add(dependency);
  }

  public void addPermission(String path, String actions)
  {
    addPermission(new FilePermission(path, actions));
  }
View Full Code Here

TOP

Related Classes of java.io.FilePermission

Copyright © 2018 www.massapicom. 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.