GNU Classpath (0.18) | ||
Frames | No Frames |
1: /* OutputStream.java -- 2: Copyright (C) 2005 Free Software Foundation, Inc. 3: 4: This file is part of GNU Classpath. 5: 6: GNU Classpath is free software; you can redistribute it and/or modify 7: it under the terms of the GNU General Public License as published by 8: the Free Software Foundation; either version 2, or (at your option) 9: any later version. 10: 11: GNU Classpath is distributed in the hope that it will be useful, but 12: WITHOUT ANY WARRANTY; without even the implied warranty of 13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14: General Public License for more details. 15: 16: You should have received a copy of the GNU General Public License 17: along with GNU Classpath; see the file COPYING. If not, write to the 18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19: 02110-1301 USA. 20: 21: Linking this library statically or dynamically with other modules is 22: making a combined work based on this library. Thus, the terms and 23: conditions of the GNU General Public License cover the whole 24: combination. 25: 26: As a special exception, the copyright holders of this library give you 27: permission to link this library with independent modules to produce an 28: executable, regardless of the license terms of these independent 29: modules, and to copy and distribute the resulting executable under 30: terms of your choice, provided that you also meet, for each linked 31: independent module, the terms and conditions of the license of that 32: module. An independent module is a module which is not derived from 33: or based on this library. If you modify this library, you may extend 34: this exception to your version of the library, but you are not 35: obligated to do so. If you do not wish to do so, delete this 36: exception statement from your version. */ 37: 38: 39: package org.omg.CORBA_2_3.portable; 40: 41: import gnu.CORBA.CDR.Vio; 42: 43: import org.omg.CORBA.portable.BoxedValueHelper; 44: import org.omg.CORBA.portable.ValueBase; 45: 46: import java.io.Serializable; 47: 48: /** 49: * This class defines a new CDR input stream methods, added since 50: * CORBA 2.3. 51: * 52: * This class is abstract; no direct instances can be instantiated. 53: * Also, up till v 1.4 inclusive there are no methods that would 54: * return it directly. 55: * 56: * However since 1.3 all methods, declared as returning an 57: * org.omg.CORBA.portable.InputStream actually return the instance of this 58: * derived class and the new methods are accessible after the casting 59: * operation. 60: * 61: * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) 62: */ 63: public abstract class OutputStream 64: extends org.omg.CORBA.portable.OutputStream 65: { 66: /** 67: * Writes an abstract interface to the stream. An abstract interface can 68: * be eithe CORBA object or value type and is written as a union with 69: * the boolean discriminator (false for objects, true for value types). 70: * 71: * The object from value is separated by fact that all values implement 72: * the {@link ValueBase} interface. Also, the passed parameter is treated 73: * as value it it does not implement CORBA Object. 74: * 75: * @param an_interface an abstract interface to write. 76: */ 77: public void write_abstract_interface(java.lang.Object an_interface) 78: { 79: boolean isValue = 80: an_interface instanceof ValueBase || 81: (!(an_interface instanceof org.omg.CORBA.Object)); 82: 83: write_boolean(isValue); 84: 85: if (isValue) 86: write_value((ValueBase) an_interface); 87: else 88: write_Object((org.omg.CORBA.Object) an_interface); 89: } 90: 91: /** 92: * Writes a value type into the output stream. 93: * 94: * The value type must implement either {@link CustomValue} 95: * (for user-defined writing method) or {@link StramableValue} 96: * (for standard writing using code, generated by IDL compiler). 97: * 98: * The written record will have a repository id, matching the 99: * class of the passed object. The codebase will not be written. 100: * 101: * @param value a value type object to write. 102: */ 103: public void write_value(Serializable value) 104: { 105: Vio.write(this, value); 106: } 107: 108: /** 109: * Write value to the stream using the boxed value helper. 110: * 111: * The value type must implement either {@link CustomValue} 112: * (for user-defined writing method) or {@link StramableValue} 113: * (for standard writing using code, generated by IDL compiler). 114: * 115: * @param value a value to write. 116: * @param helper a helper, responsible for the writing operation. 117: */ 118: public void write_value(Serializable value, BoxedValueHelper helper) 119: { 120: Vio.write(this, value, helper); 121: } 122: 123: /** 124: * Writes a value type into the output stream, stating it is an 125: * instance of the given class. The written record 126: * will have a repository id, matching the passed class. 127: * The codebase will not be written. 128: * 129: * The value type must implement either {@link CustomValue} 130: * (for user-defined writing method) or {@link StramableValue} 131: * (for standard writing using code, generated by IDL compiler). 132: * 133: * @param value a value type object to write. 134: */ 135: public void write_value(Serializable value, Class clz) 136: { 137: Vio.write(this, value, clz); 138: } 139: 140: /** 141: * Writes a value type into the output stream, 142: * stating it has the given repository id. 143: * 144: * The value type must implement either {@link CustomValue} 145: * (for user-defined writing method) or {@link StramableValue} 146: * (for standard writing using code, generated by IDL compiler). 147: * 148: * @param repository_id a repository id of the value type. 149: * 150: * @param value a value type object to write. 151: */ 152: public void write_value(Serializable value, String repository_id) 153: { 154: Vio.write(this, value, repository_id); 155: }
GNU Classpath (0.18) |