getActions(): This method is available in the java.net.SocketPermission class of Java.
Syntax:
String java.net.SocketPermission.getActions()
This method returns the canonical string representation of the actions. Always returns present actions in the following order: connect, listen, accept, resolve.
Parameters: NA
Returns: the canonical string representation of the actions.
Exceptions: NA
Approach
Java
package com.SocketPermission;import java.net.SocketPermission;public class SocketPermissiongetActions {public static void main(String[] args) {String host = "google.com";String action = "connect";SocketPermission socketPermission = new SocketPermission(host, action);System.out.println(socketPermission.getActions());}}
Output:
connect,resolve
Some other methods of SocketPermission
SocketPermission(String, String): This method creates a new SocketPermission object with the specified actions. The host is expressed as a DNS name, or as a numerical IP address.
equals(Object): This method checks two SocketPermission objects for equality.
getActions(): This method returns the canonical string representation of the actions. Always returns present actions in the following order: connect, listen, accept, resolve.
hashCode(): This method returns the hash code value for this object.
implies(Permission): This method checks if this socket permission object "implies" the specified permission.
newPermissionCollection(): This method returns a new PermissionCollection object for storing SocketPermission objects.
No comments:
Post a Comment