1 /* 2 * Copyright (c) 1998, 2017, 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 32 package org.omg.CORBA_2_3.portable; 33 34 import java.io.SerializablePermission; 35 import java.security.AccessController; 36 import 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 48 public 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 * @implNote 79 * Throws SecurityException if SecurityManager is installed and 80 * enableSubclassImplementation SerializablePermission 81 * is not granted or jdk.corba.allowInputStreamSubclass system 82 * property is either not set or is set to 'false'. 83 */ 84 public InputStream() { 85 this(checkPermission()); 86 } 87 88 /** 89 * Unmarshalls a value type from the input stream. 90 * @return the value type unmarshalled from the input stream 91 */ 92 public java.io.Serializable read_value() { 93 throw new org.omg.CORBA.NO_IMPLEMENT(); 94 } 95 96 /** 97 * Unmarshalls a value type from the input stream. 98 * @param clz is the declared type of the value to be unmarshalled 99 * @return the value unmarshalled from the input stream 100 */ 101 public java.io.Serializable read_value(java.lang.Class clz) { 102 throw new org.omg.CORBA.NO_IMPLEMENT(); 103 } 104 105 /** 106 * Unmarshalls a value type from the input stream. 107 * @param factory is the instance fo the helper to be used for 108 * unmarshalling the value type 109 * @return the value unmarshalled from the input stream 110 */ 111 public java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper factory) { 112 throw new org.omg.CORBA.NO_IMPLEMENT(); 113 } 114 115 /** 116 * Unmarshalls a value type from the input stream. 117 * @param rep_id identifies the type of the value to be unmarshalled 118 * @return value type unmarshalled from the input stream 119 */ 120 public java.io.Serializable read_value(java.lang.String rep_id) { 121 throw new org.omg.CORBA.NO_IMPLEMENT(); 122 } 123 124 /** 125 * Unmarshalls a value type from the input stream. 126 * @param value is an uninitialized value which is added to the orb's 127 * indirection table before calling Streamable._read() or 128 * CustomMarshal.unmarshal() to unmarshal the value. 129 * @return value type unmarshalled from the input stream 130 */ 131 public java.io.Serializable read_value(java.io.Serializable value) { 132 throw new org.omg.CORBA.NO_IMPLEMENT(); 133 } 134 135 /** 136 * Unmarshal the value object or a suitable stub object. 137 * @return ORB runtime returns the value object or a suitable stub object. 138 */ 139 public java.lang.Object read_abstract_interface() { 140 throw new org.omg.CORBA.NO_IMPLEMENT(); 141 } 142 143 /** 144 * Unmarshal the class object or the stub class corresponding to the passed type. 145 * @param clz is the Class object for the stub class which corresponds to 146 * the type that is statically expected. 147 * @return ORB runtime returns the value object or a suitable stub object. 148 */ 149 public java.lang.Object read_abstract_interface(java.lang.Class clz) { 150 throw new org.omg.CORBA.NO_IMPLEMENT(); 151 } 152 153 }