1 /*
   2  * Copyright (c) 1997, 2004, 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 package org.omg.CORBA.portable;
  26 
  27 import org.omg.CORBA.TypeCode;
  28 import org.omg.CORBA.Principal;
  29 import org.omg.CORBA.Any;
  30 
  31 /**
  32  * OuputStream is the Java API for writing IDL types
  33  * to CDR marshal streams. These methods are used by the ORB to
  34  * marshal IDL types as well as to insert IDL types into Anys.
  35  * The <code>_array</code> versions of the methods can be directly
  36  * used to write sequences and arrays of IDL types.
  37  *
  38  * @since   JDK1.2
  39  */
  40 
  41 
  42 public abstract class OutputStream extends java.io.OutputStream
  43 {
  44     /**
  45      * Returns an input stream with the same buffer.
  46      *@return an input stream with the same buffer.
  47      */
  48     public abstract InputStream create_input_stream();
  49 
  50     /**
  51      * Writes a boolean value to this stream.
  52      * @param value the value to be written.
  53      */
  54     public abstract void write_boolean(boolean value);
  55     /**
  56      * Writes a char value to this stream.
  57      * @param value the value to be written.
  58      */
  59     public abstract void write_char(char value);
  60     /**
  61      * Writes a wide char value to this stream.
  62      * @param value the value to be written.
  63      */
  64     public abstract void write_wchar(char value);
  65     /**
  66      * Writes a CORBA octet (i.e. byte) value to this stream.
  67      * @param value the value to be written.
  68      */
  69     public abstract void write_octet(byte value);
  70     /**
  71      * Writes a short value to this stream.
  72      * @param value the value to be written.
  73      */
  74     public abstract void write_short(short value);
  75     /**
  76      * Writes an unsigned short value to this stream.
  77      * @param value the value to be written.
  78      */
  79     public abstract void write_ushort(short value);
  80     /**
  81      * Writes a CORBA long (i.e. Java int) value to this stream.
  82      * @param value the value to be written.
  83      */
  84     public abstract void write_long(int value);
  85     /**
  86      * Writes an unsigned CORBA long (i.e. Java int) value to this stream.
  87      * @param value the value to be written.
  88      */
  89     public abstract void write_ulong(int value);
  90     /**
  91      * Writes a CORBA longlong (i.e. Java long) value to this stream.
  92      * @param value the value to be written.
  93      */
  94     public abstract void write_longlong(long value);
  95     /**
  96      * Writes an unsigned CORBA longlong (i.e. Java long) value to this stream.
  97      * @param value the value to be written.
  98      */
  99     public abstract void write_ulonglong(long value);
 100     /**
 101      * Writes a float value to this stream.
 102      * @param value the value to be written.
 103      */
 104     public abstract void write_float(float value);
 105     /**
 106      * Writes a double value to this stream.
 107      * @param value the value to be written.
 108      */
 109     public abstract void write_double(double value);
 110     /**
 111      * Writes a string value to this stream.
 112      * @param value the value to be written.
 113      */
 114     public abstract void write_string(String value);
 115     /**
 116      * Writes a wide string value to this stream.
 117      * @param value the value to be written.
 118      */
 119     public abstract void write_wstring(String value);
 120 
 121     /**
 122      * Writes an array of booleans on this output stream.
 123      * @param value the array to be written.
 124      * @param offset offset on the stream.
 125      * @param length length of buffer to write.
 126      */
 127     public abstract void write_boolean_array(boolean[] value, int offset,
 128                                              int length);
 129     /**
 130      * Writes an array of chars on this output stream.
 131      * @param value the array to be written.
 132      * @param offset offset on the stream.
 133      * @param length length of buffer to write.
 134      */
 135     public abstract void write_char_array(char[] value, int offset,
 136                                           int length);
 137     /**
 138      * Writes an array of wide chars on this output stream.
 139      * @param value the array to be written.
 140      * @param offset offset on the stream.
 141      * @param length length of buffer to write.
 142      */
 143     public abstract void write_wchar_array(char[] value, int offset,
 144                                            int length);
 145     /**
 146      * Writes an array of CORBA octets (bytes) on this output stream.
 147      * @param value the array to be written.
 148      * @param offset offset on the stream.
 149      * @param length length of buffer to write.
 150      */
 151     public abstract void write_octet_array(byte[] value, int offset,
 152                                            int length);
 153     /**
 154      * Writes an array of shorts on this output stream.
 155      * @param value the array to be written.
 156      * @param offset offset on the stream.
 157      * @param length length of buffer to write.
 158      */
 159     public abstract void write_short_array(short[] value, int offset,
 160                                            int length);
 161     /**
 162      * Writes an array of unsigned shorts on this output stream.
 163      * @param value the array to be written.
 164      * @param offset offset on the stream.
 165      * @param length length of buffer to write.
 166      */
 167     public abstract void write_ushort_array(short[] value, int offset,
 168                                             int length);
 169     /**
 170      * Writes an array of CORBA longs (i.e. Java ints) on this output stream.
 171      * @param value the array to be written.
 172      * @param offset offset on the stream.
 173      * @param length length of buffer to write.
 174      */
 175     public abstract void write_long_array(int[] value, int offset,
 176                                           int length);
 177     /**
 178      * Writes an array of unsigned CORBA longs (i.e. Java ints) on this output stream.
 179      * @param value the array to be written.
 180      * @param offset offset on the stream.
 181      * @param length length of buffer to write.
 182      */
 183     public abstract void write_ulong_array(int[] value, int offset,
 184                                            int length);
 185     /**
 186      * Writes an array of CORBA longlongs (i.e. Java longs) on this output stream.
 187      * @param value the array to be written.
 188      * @param offset offset on the stream.
 189      * @param length length of buffer to write.
 190      */
 191     public abstract void write_longlong_array(long[] value, int offset,
 192                                               int length);
 193     /**
 194      * Writes an array of unsigned CORBA longlongs (i.e. Java ints) on this output stream.
 195      * @param value the array to be written.
 196      * @param offset offset on the stream.
 197      * @param length length of buffer to write.
 198      */
 199     public abstract void write_ulonglong_array(long[] value, int offset,
 200                                                int length);
 201     /**
 202      * Writes an array of floats on this output stream.
 203      * @param value the array to be written.
 204      * @param offset offset on the stream.
 205      * @param length length of buffer to write.
 206      */
 207     public abstract void write_float_array(float[] value, int offset,
 208                                            int length);
 209     /**
 210      * Writes an array of doubles on this output stream.
 211      * @param value the array to be written.
 212      * @param offset offset on the stream.
 213      * @param length length of buffer to write.
 214      */
 215     public abstract void write_double_array(double[] value, int offset,
 216                                             int length);
 217     /**
 218      * Writes a CORBA Object on this output stream.
 219      * @param value the value to be written.
 220      */
 221     public abstract void write_Object(org.omg.CORBA.Object value);
 222     /**
 223      * Writes a TypeCode on this output stream.
 224      * @param value the value to be written.
 225      */
 226     public abstract void write_TypeCode(TypeCode value);
 227     /**
 228      * Writes an Any on this output stream.
 229      * @param value the value to be written.
 230      */
 231     public abstract void write_any(Any value);
 232 
 233     /**
 234      * Writes a Principle on this output stream.
 235      * @param value the value to be written.
 236      * @deprecated Deprecated by CORBA 2.2.
 237      */
 238     @Deprecated
 239     public void write_Principal(Principal value) {
 240         throw new org.omg.CORBA.NO_IMPLEMENT();
 241     }
 242 
 243     /**
 244      * Writes an integer (length of arrays) onto this stream.
 245      * @param b the value to be written.
 246      * @throws java.io.IOException if there is an input/output error
 247      * @see <a href="package-summary.html#unimpl"><code>portable</code>
 248      * package comments for unimplemented features</a>
 249      */
 250     public void write(int b) throws java.io.IOException {
 251         throw new org.omg.CORBA.NO_IMPLEMENT();
 252     }
 253 
 254     /**
 255      * Writes a BigDecimal number.
 256      * @param value a BidDecimal--value to be written.
 257      */
 258     public void write_fixed(java.math.BigDecimal value) {
 259         throw new org.omg.CORBA.NO_IMPLEMENT();
 260     }
 261 
 262     /**
 263      * Writes a CORBA context on this stream. The
 264      * Context is marshaled as a sequence of strings.
 265      * Only those Context values specified in the contexts
 266      * parameter are actually written.
 267      * @param ctx a CORBA context
 268      * @param contexts a <code>ContextList</code> object containing the list of contexts
 269      *        to be written
 270      * @see <a href="package-summary.html#unimpl"><code>portable</code>
 271      * package comments for unimplemented features</a>
 272      */
 273     public void write_Context(org.omg.CORBA.Context ctx,
 274                               org.omg.CORBA.ContextList contexts) {
 275         throw new org.omg.CORBA.NO_IMPLEMENT();
 276     }
 277 
 278     /**
 279      * Returns the ORB that created this OutputStream.
 280      * @return the ORB that created this OutputStream
 281      * @see <a href="package-summary.html#unimpl"><code>portable</code>
 282      * package comments for unimplemented features</a>
 283      */
 284     public org.omg.CORBA.ORB orb() {
 285         throw new org.omg.CORBA.NO_IMPLEMENT();
 286     }
 287 }