java.nio.file.LinkPermission Class in Java Last Updated : 19 Jul, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report The java.nio.file.LinkPermission class handles permissions for link creation operations. The permission allowed by these class are as follows: Permission name What permission allows Risk of granting this permission hard This permission allows adding an existing file to a directory. This operation is also known as creating a hard link. The attacker may have access to all files because this permission allows linking to any file in the file system. symbolic This permission allows creating file pointers. This operation is also known as creating soft/symbolic link. The attacker may have access to all files because this permission allows linking to any file in the file system. Class declaration: public final class LinkPermission extends BasicPermissionConstructor: ConstructorDescription LinkPermission(String name)This constructor is used to create a LinkPermission with the specified name.LinkPermission(String name, String actions)This constructor is used to create a LinkPermission with the specified name and action. Methods inherited from class java.security.BasicPermission: MethodDescriptionequals(Object obj)This method checks whether the two BasicPermission objects are equal or notgetActions()This method returns the actions in String formathashCode()This method returns the hash code value for this objectimplies(Permission permission)This method checks whether the given permission is implied by this object or notnewPermissionCollection()This method returns a new PermissionCollection objectExample 1: Java program to create a new hard LinkPermission Java // Java program to create a new hard LinkPermission import java.nio.file.LinkPermission; import java.security.Permission; // Driver class public class GFG { // Main method public static void main(String[] args) { try { // Creating a new LinkPermission object Permission permission = new LinkPermission("hard"); // Printing name of the permission System.out.println(permission.getName()); // Printing class of the permission object System.out.println(permission.getClass()); // Printing hash value of the permission object System.out.println(permission.hashCode()); } catch (Exception e) { e.printStackTrace(); } } } Outputhard class java.nio.file.LinkPermission 3195115Example 2: Java program to create a new symbolic LinkPermission Java // Java program to create a new symbolic LinkPermission import java.nio.file.LinkPermission; import java.security.Permission; // Driver class public class GFG { // Main method public static void main(String[] args) { try { // Creating a new LinkPermission object Permission permission = new LinkPermission("symbolic"); // Printing name of the permission System.out.println(permission.getName()); // Printing class of the permission object System.out.println(permission.getClass()); // Printing hash value of the permission object System.out.println(permission.hashCode()); } catch (Exception e) { e.printStackTrace(); } } } Outputsymbolic class java.nio.file.LinkPermission 1787985074Example 3: Java program to compare two LinkPermission objects Java // Java program to compare two LinkPermission objects import java.nio.file.LinkPermission; import java.security.Permission; // Driver class public class GFG { // Main method public static void main(String[] args) { try { Permission hardPermission = new LinkPermission("hard"); Permission softPermission = new LinkPermission("symbolic"); // Checking is both permissions are equal or not if (hardPermission.equals(softPermission)) { System.out.println( "Both permission are equal"); } else { System.out.println( "Both permission are not equal"); } } catch (Exception e) { e.printStackTrace(); } } } OutputBoth permission are not equal Comment More infoAdvertise with us Next Article java.net.SocketPermission Class in Java A abhinavjain194 Follow Improve Article Tags : Java Java-NIO package Java-Classes Practice Tags : Java Similar Reads java.net.NetPermission Class in Java NetPermission class is used to allow network permissions. NetPermission class extends BasicPermission class. It is a ânamedâ permission i.e it contains a name but no action. Permission nameWhat permission allowsRisks associated with this permissionallowHttpTraceThis permission allows using the HTTP 4 min read java.net.SocketPermission Class in Java The java.net.SocketPermisson class represents whether you have permission to access a network via sockets. A SocketPermission consists of a host and a set of actions. Class Declaration: public final class SocketPermission extends Permission implements SerializableConstructor: ConstructorDescriptionM 2 min read java.nio.file.Paths Class in Java java.nio.file.Paths class contains static methods for converting path string or URI into Path. Class declaration : public final class Paths extends ObjectMethods: MethodDescriptionget(String first, String... more) This method converts a path string, or a sequence of strings that when joined form a p 2 min read Java.util.PropertyPermission class in Java This class is for property permission. It extends BasicPermission. The name is the name of the property ("java.home", "os.name", etc). The naming convention follows the hierarchical property naming convention. Also, an asterisk may appear at the end of the name, following a ".", or by itself, to sig 4 min read java.nio.file.SimpleFileVisitor Class in Java The java.nio.file.SimpleFileVisitor Class is used to visit all the files in a directory and to re-throw I/O exceptions whenever an I/O error occurs. Class declaration : public class SimpleFileVisitor<T> extends Object implements FileVisitor<T>Constructor: protected SimpleFileVIsitor(): C 3 min read File Permissions in Java Java provides a number of method calls to check and change the permission of a file, such as a read-only file can be changed to have permissions to write. File permissions are required to be changed when the user wants to restrict the operations permissible on a file. For example, file permission ca 3 min read Like