当前位置: 首页>>代码示例>>Java>>正文


Java SerializablePermission类代码示例

本文整理汇总了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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:InputStream.java

示例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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:StubFactoryDynamicBase.java

示例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);
}
 
开发者ID:mbechler,项目名称:marshalsec,代码行数:37,代码来源:SideEffectSecurityManager.java

示例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;
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:22,代码来源:ObjectInputFilter.java

示例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"));
}
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:Util.java

示例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"));
        }
    }
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:13,代码来源:Util.java

示例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());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:16,代码来源:SerializablePermissionTest.java

示例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());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:18,代码来源:SerializablePermissionTest.java

示例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());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:10,代码来源:SerializablePermissionTest.java

示例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());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:12,代码来源:SerializablePermissionTest.java


注:本文中的java.io.SerializablePermission类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。