本文整理汇总了Java中java.io.SerializablePermission类的典型用法代码示例。如果您正苦于以下问题:Java SerializablePermission类的具体用法?Java SerializablePermission怎么用?Java SerializablePermission使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SerializablePermission类属于java.io包,在下文中一共展示了SerializablePermission类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkPermission
import java.io.SerializablePermission; //导入依赖的package包/类
private static Void checkPermission() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
if (!allowSubclass)
sm.checkPermission(new
SerializablePermission("enableSubclassImplementation"));
}
return null;
}
示例2: checkPermission
import java.io.SerializablePermission; //导入依赖的package包/类
private static Void checkPermission() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new SerializablePermission(
"enableSubclassImplementation"));
}
return null;
}
示例3: checkPermission
import java.io.SerializablePermission; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @see java.lang.SecurityManager#checkPermission(java.security.Permission)
*/
@Override
public void checkPermission ( Permission perm ) {
if ( perm instanceof RuntimePermission ) {
if ( checkRuntimePermission((RuntimePermission) perm) ) {
return;
}
}
else if ( perm instanceof ReflectPermission ) {
return;
}
else if ( perm instanceof LoggingPermission ) {
return;
}
else if ( perm instanceof SecurityPermission ) {
return;
}
else if ( perm instanceof PropertyPermission ) {
return;
}
else if ( perm instanceof NetPermission && perm.getName().equals("specifyStreamHandler") ) {
return;
}
else if ( perm instanceof FilePermission && perm.getActions().equals("read") ) {
return;
}
else if ( perm instanceof SerializablePermission ) {
return;
}
super.checkPermission(perm);
}
示例4: setSerialFilter
import java.io.SerializablePermission; //导入依赖的package包/类
/**
* Set the process-wide filter if it has not already been configured or set.
*
* @param filter the serialization filter to set as the process-wide filter; not null
* @throws SecurityException if there is security manager and the
* {@code SerializablePermission("serialFilter")} is not granted
* @throws IllegalStateException if the filter has already been set {@code non-null}
*/
public static void setSerialFilter(ObjectInputFilter filter) {
Objects.requireNonNull(filter, "filter");
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new SerializablePermission("serialFilter"));
}
synchronized (serialFilterLock) {
if (serialFilter != null) {
throw new IllegalStateException("Serial filter can only be set once");
}
serialFilter = filter;
}
}
示例5: isCustomSerializationPermitted
import java.io.SerializablePermission; //导入依赖的package包/类
private static void isCustomSerializationPermitted() {
SecurityManager sm = System.getSecurityManager();
if ( sm != null) {
// check that a serialization permission has been
// set to allow the loading of the Util delegate
// which provides access to custom ValueHandler
sm.checkPermission(new SerializablePermission(
"enableCustomValueHandler"));
}
}
示例6: isCustomSerializationPermitted
import java.io.SerializablePermission; //导入依赖的package包/类
private static void isCustomSerializationPermitted() {
SecurityManager sm = System.getSecurityManager();
if (!allowCustomValueHandler) {
if ( sm != null) {
// check that a serialization permission has been
// set to allow the loading of the Util delegate
// which provides access to custom ValueHandler
sm.checkPermission(new SerializablePermission(
"enableCustomValueHandler"));
}
}
}
示例7: test_ConstructorLjava_lang_String
import java.io.SerializablePermission; //导入依赖的package包/类
/**
* @tests java.io.SerializablePermission#SerializablePermission(java.lang.String)
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "SerializablePermission",
args = {java.lang.String.class}
)
public void test_ConstructorLjava_lang_String() {
// Test for method java.io.SerializablePermission(java.lang.String)
assertEquals("permission ill-formed",
"enableSubclassImplementation", new SerializablePermission(
"enableSubclassImplementation").getName());
}
示例8: test_ConstructorLjava_lang_StringLjava_lang_String
import java.io.SerializablePermission; //导入依赖的package包/类
/**
* @tests java.io.SerializablePermission#SerializablePermission(java.lang.String,
* java.lang.String)
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "SerializablePermission",
args = {java.lang.String.class, java.lang.String.class}
)
public void test_ConstructorLjava_lang_StringLjava_lang_String() {
// Test for method java.io.SerializablePermission(java.lang.String,
// java.lang.String)
assertEquals("permission ill-formed",
"enableSubclassImplementation", new SerializablePermission(
"enableSubclassImplementation", "").getName());
}
示例9: test_ConstructorLjava_lang_String
import java.io.SerializablePermission; //导入依赖的package包/类
/**
* @tests java.io.SerializablePermission#SerializablePermission(java.lang.String)
*/
public void test_ConstructorLjava_lang_String() {
// Test for method java.io.SerializablePermission(java.lang.String)
assertEquals("permission ill-formed",
"enableSubclassImplementation", new SerializablePermission(
"enableSubclassImplementation").getName());
}
示例10: test_ConstructorLjava_lang_StringLjava_lang_String
import java.io.SerializablePermission; //导入依赖的package包/类
/**
* @tests java.io.SerializablePermission#SerializablePermission(java.lang.String,
* java.lang.String)
*/
public void test_ConstructorLjava_lang_StringLjava_lang_String() {
// Test for method java.io.SerializablePermission(java.lang.String,
// java.lang.String)
assertEquals("permission ill-formed",
"enableSubclassImplementation", new SerializablePermission(
"enableSubclassImplementation", "").getName());
}