InputStream.java revision 608:7e06bf1dcb09
1/*
2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25/*
26 * Licensed Materials - Property of IBM
27 * RMI-IIOP v1.0
28 * Copyright IBM Corp. 1998 1999  All Rights Reserved
29 *
30 */
31
32package org.omg.CORBA_2_3.portable;
33
34import java.io.SerializablePermission;
35import java.security.AccessController;
36import java.security.PrivilegedAction;
37
38/**
39 * InputStream provides for the reading of all of the mapped IDL types
40 * from the stream. It extends org.omg.CORBA.portable.InputStream.  This
41 * class defines new methods that were added for CORBA 2.3.
42 *
43 * @see org.omg.CORBA.portable.InputStream
44 * @author  OMG
45 * @since   JDK1.2
46 */
47
48public abstract class InputStream extends org.omg.CORBA.portable.InputStream {
49
50
51    private static final String ALLOW_SUBCLASS_PROP = "jdk.corba.allowInputStreamSubclass";
52
53    private static final boolean allowSubclass = AccessController.doPrivileged(
54        new PrivilegedAction<Boolean>() {
55            @Override
56            public Boolean run() {
57            String prop = System.getProperty(ALLOW_SUBCLASS_PROP);
58                return prop == null ? false :
59                           (prop.equalsIgnoreCase("false") ? false : true);
60            }
61        });
62
63    private static Void checkPermission() {
64        SecurityManager sm = System.getSecurityManager();
65        if (sm != null) {
66            if (!allowSubclass)
67                sm.checkPermission(new
68                    SerializablePermission("enableSubclassImplementation"));
69        }
70        return null;
71    }
72
73    private InputStream(Void ignore) { }
74
75    /**
76     * Create a new instance of this class.
77     *
78     * throw SecurityException if SecurityManager is installed and
79     * enableSubclassImplementation SerializablePermission
80     * is not granted or jdk.corba.allowOutputStreamSubclass system
81     * property is either not set or is set to 'false'
82     */
83    public InputStream() {
84        this(checkPermission());
85    }
86
87    /**
88     * Unmarshalls a value type from the input stream.
89     * @return the value type unmarshalled from the input stream
90     */
91    public java.io.Serializable read_value() {
92        throw new org.omg.CORBA.NO_IMPLEMENT();
93    }
94
95    /**
96     * Unmarshalls a value type from the input stream.
97     * @param clz is the declared type of the value to be unmarshalled
98     * @return the value unmarshalled from the input stream
99     */
100    public java.io.Serializable read_value(java.lang.Class clz) {
101        throw new org.omg.CORBA.NO_IMPLEMENT();
102    }
103
104    /**
105     * Unmarshalls a value type from the input stream.
106     * @param factory is the instance fo the helper to be used for
107     * unmarshalling the value type
108     * @return the value unmarshalled from the input stream
109     */
110    public java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper factory) {
111        throw new org.omg.CORBA.NO_IMPLEMENT();
112    }
113
114    /**
115     * Unmarshalls a value type from the input stream.
116     * @param rep_id identifies the type of the value to be unmarshalled
117     * @return value type unmarshalled from the input stream
118     */
119    public java.io.Serializable read_value(java.lang.String rep_id) {
120        throw new org.omg.CORBA.NO_IMPLEMENT();
121    }
122
123    /**
124     * Unmarshalls a value type from the input stream.
125     * @param value is an uninitialized value which is added to the orb's
126     * indirection table before calling Streamable._read() or
127     * CustomMarshal.unmarshal() to unmarshal the value.
128     * @return value type unmarshalled from the input stream
129     */
130    public java.io.Serializable read_value(java.io.Serializable value) {
131        throw new org.omg.CORBA.NO_IMPLEMENT();
132    }
133
134    /**
135     * Unmarshal the value object or a suitable stub object.
136     * @return ORB runtime returns the value object or a suitable stub object.
137     */
138    public java.lang.Object read_abstract_interface() {
139        throw new org.omg.CORBA.NO_IMPLEMENT();
140    }
141
142    /**
143     * Unmarshal the class object or the stub class corresponding to the passed type.
144     * @param clz is the Class object for the stub class which corresponds to
145     * the type that is statically expected.
146     * @return ORB runtime returns the value object or a suitable stub object.
147     */
148    public java.lang.Object read_abstract_interface(java.lang.Class clz) {
149        throw new org.omg.CORBA.NO_IMPLEMENT();
150    }
151
152}
153