Java.io - SPLessons

Java.io SerializablePermission

Home > Lesson > Chapter 47
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

Java.io SerializablePermission

Java.io SerializablePermission

shape Introduction

Java.io SerializablePermission - The serializable is the class which represents a target name and it is the name of Java.io SerializablePermission. Java.io SerializablePermission class is declared below: Public final class SerializablePermission extends Basic Permission

Class Constructors

shape Table

Constructor Description
SerializablePermission(String name) The function of this constructor is to create a new Java.io SerializablePermission with represented name.
SerializablePermission(String name, String actions) The function of this constructor is to create a new Java.io SerializablePermission instance with represented name and action.

Inherited Methods

shape Description

From the following classes, methods are inherited to the Java.io SerializablePermission class.
  • Java.io.Object
  • Java.io.BasicPermission
  • Java.io.Permission

shape Example

Following is an source code for Java.io SerializablePermission. SerializablePermission.java [java]import java.security.BasicPermission; /** * This class models permissions related to serialization. As a subclass * of <code>BasicPermission</code>, this class has permissions that have * a name only. There is no associated action list. * <p> * There are currently two allowable permission names for this class: * <ul> * <li><code>enableSubclassImplementation</code> - Allows a subclass to * override the default serialization behavior of objects. * <li><code>enableSubstitution</code> - Allows substitution of one object * for another during serialization or deserialization. * @author Aaron M. Renn (arenn@urbanophile.com) */ public final class SerializablePermission extends BasicPermission { /* * Class Variables */ private static final String[] legal_names = { "enableSubclassImplementation", "enableSubstitution" }; /* * Constructors */ /** * This method initializes a new instance of <code>SerializablePermission</code> * that has the specified name. * * @param name The name of the permission. * * @exception IllegalArgumentException If the name is not valid for this class. */ public SerializablePermission(String name) { this(name, null); } /** * This method initializes a new instance of <code>SerializablePermission</code> * that has the specified name and action list. Note that the action list * is unused in this class. * * @param name The name of the permission. * @param actions The action list (unused). * * @exception IllegalArgumentException If the name is not valid for this class. */ public SerializablePermission(String name, String actions) { super(name, actions); for (int i = 0; i < legal_names.length; i++) if (legal_names[i].equals(name)) return; throw new IllegalArgumentException("Bad permission name: " + name); } } // class SerializablePermission [/java]

Summary

shape Key Points

  • The serializable is the class which represents a target name and it is the name of Java.io SerializablePermission.