EncapsInputStreamFactory.java revision 608:7e06bf1dcb09
1/* 2 * Copyright (c) 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 */ 25package sun.corba; 26 27import java.nio.ByteBuffer; 28import java.security.AccessController; 29import java.security.PrivilegedAction; 30 31 32import com.sun.corba.se.impl.encoding.EncapsInputStream; 33import com.sun.corba.se.impl.encoding.TypeCodeInputStream; 34import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; 35import com.sun.corba.se.pept.protocol.MessageMediator; 36import com.sun.corba.se.spi.ior.iiop.GIOPVersion; 37import com.sun.corba.se.spi.orb.ORB; 38import com.sun.org.omg.SendingContext.CodeBase; 39 40public class EncapsInputStreamFactory { 41 42 public static EncapsInputStream newEncapsInputStream( 43 final org.omg.CORBA.ORB orb, final byte[] buf, final int size, 44 final boolean littleEndian, final GIOPVersion version) { 45 return AccessController 46 .doPrivileged(new PrivilegedAction<EncapsInputStream>() { 47 @Override 48 public EncapsInputStream run() { 49 return new EncapsInputStream(orb, buf, size, 50 littleEndian, version); 51 } 52 }); 53 } 54 55 public static EncapsInputStream newEncapsInputStream( 56 final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer, 57 final int size, final boolean littleEndian, 58 final GIOPVersion version) { 59 return AccessController 60 .doPrivileged(new PrivilegedAction<EncapsInputStream>() { 61 @Override 62 public EncapsInputStream run() { 63 return new EncapsInputStream(orb, byteBuffer, size, 64 littleEndian, version); 65 } 66 }); 67 } 68 69 public static EncapsInputStream newEncapsInputStream( 70 final org.omg.CORBA.ORB orb, final byte[] data, final int size) { 71 return AccessController 72 .doPrivileged(new PrivilegedAction<EncapsInputStream>() { 73 @Override 74 public EncapsInputStream run() { 75 return new EncapsInputStream(orb, data, size); 76 } 77 }); 78 } 79 80 public static EncapsInputStream newEncapsInputStream( 81 final EncapsInputStream eis) { 82 return AccessController 83 .doPrivileged(new PrivilegedAction<EncapsInputStream>() { 84 @Override 85 public EncapsInputStream run() { 86 return new EncapsInputStream(eis); 87 } 88 }); 89 } 90 91 public static EncapsInputStream newEncapsInputStream( 92 final org.omg.CORBA.ORB orb, final byte[] data, final int size, 93 final GIOPVersion version) { 94 return AccessController 95 .doPrivileged(new PrivilegedAction<EncapsInputStream>() { 96 @Override 97 public EncapsInputStream run() { 98 return new EncapsInputStream(orb, data, size, version); 99 } 100 }); 101 } 102 103 public static EncapsInputStream newEncapsInputStream( 104 final org.omg.CORBA.ORB orb, final byte[] data, final int size, 105 final GIOPVersion version, final CodeBase codeBase) { 106 return AccessController 107 .doPrivileged(new PrivilegedAction<EncapsInputStream>() { 108 @Override 109 public EncapsInputStream run() { 110 return new EncapsInputStream(orb, data, size, version, 111 codeBase); 112 } 113 }); 114 } 115 116 public static TypeCodeInputStream newTypeCodeInputStream( 117 final org.omg.CORBA.ORB orb, final byte[] buf, final int size, 118 final boolean littleEndian, final GIOPVersion version) { 119 return AccessController 120 .doPrivileged(new PrivilegedAction<TypeCodeInputStream>() { 121 @Override 122 public TypeCodeInputStream run() { 123 return new TypeCodeInputStream(orb, buf, size, 124 littleEndian, version); 125 } 126 }); 127 } 128 129 public static TypeCodeInputStream newTypeCodeInputStream( 130 final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer, 131 final int size, final boolean littleEndian, 132 final GIOPVersion version) { 133 return AccessController 134 .doPrivileged(new PrivilegedAction<TypeCodeInputStream>() { 135 @Override 136 public TypeCodeInputStream run() { 137 return new TypeCodeInputStream(orb, byteBuffer, size, 138 littleEndian, version); 139 } 140 }); 141 } 142 143 public static TypeCodeInputStream newTypeCodeInputStream( 144 final org.omg.CORBA.ORB orb, final byte[] data, final int size) { 145 return AccessController 146 .doPrivileged(new PrivilegedAction<TypeCodeInputStream>() { 147 @Override 148 public TypeCodeInputStream run() { 149 return new TypeCodeInputStream(orb, data, size); 150 } 151 }); 152 } 153} 154