Java.util.PropertyPermission.implies() 方法 Java.util.PropertyPermission.hashCode() 方法 Java.util.PropertyPermission.newPermission Collection() 方法 Java.util.PropertyPermission.implies() 方法 package com.codingdict; import java.util.PropertyPermission; public class PropertyPermissionDemo { private static PropertyPermission permission; public static void main(String[] args) { // Create property permission object permission = new PropertyPermission("java.*", "read,write"); // Check permissions checkFileReadPermission("java.home"); checkFileWritePermission("java.home"); } private static void checkFileReadPermission(String path) { // Check permission on read action if(permission.implies(new PropertyPermission(path, "read"))) { System.out.println("Has permissions on "+path+" for read"); } } private static void checkFileWritePermission(String path) { // Check permission on read action if(permission.implies(new PropertyPermission(path, "write"))) { System.out.println("Has permissions on "+path+" for write"); } } } Java.util.PropertyPermission.hashCode() 方法 Java.util.PropertyPermission.newPermission Collection() 方法