001    /* OutputStream.java --
002       Copyright (C) 2005 Free Software Foundation, Inc.
003    
004    This file is part of GNU Classpath.
005    
006    GNU Classpath is free software; you can redistribute it and/or modify
007    it under the terms of the GNU General Public License as published by
008    the Free Software Foundation; either version 2, or (at your option)
009    any later version.
010    
011    GNU Classpath is distributed in the hope that it will be useful, but
012    WITHOUT ANY WARRANTY; without even the implied warranty of
013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014    General Public License for more details.
015    
016    You should have received a copy of the GNU General Public License
017    along with GNU Classpath; see the file COPYING.  If not, write to the
018    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
019    02110-1301 USA.
020    
021    Linking this library statically or dynamically with other modules is
022    making a combined work based on this library.  Thus, the terms and
023    conditions of the GNU General Public License cover the whole
024    combination.
025    
026    As a special exception, the copyright holders of this library give you
027    permission to link this library with independent modules to produce an
028    executable, regardless of the license terms of these independent
029    modules, and to copy and distribute the resulting executable under
030    terms of your choice, provided that you also meet, for each linked
031    independent module, the terms and conditions of the license of that
032    module.  An independent module is a module which is not derived from
033    or based on this library.  If you modify this library, you may extend
034    this exception to your version of the library, but you are not
035    obligated to do so.  If you do not wish to do so, delete this
036    exception statement from your version. */
037    
038    
039    package org.omg.CORBA.portable;
040    
041    import org.omg.CORBA.Any;
042    import org.omg.CORBA.Context;
043    import org.omg.CORBA.ContextList;
044    import org.omg.CORBA.NO_IMPLEMENT;
045    import org.omg.CORBA.ORB;
046    import org.omg.CORBA.Principal;
047    import org.omg.CORBA.TypeCode;
048    
049    import java.io.IOException;
050    
051    import java.math.BigDecimal;
052    
053    /**
054     * This class is used to write CORBA IDL data types.
055     *
056     * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
057     */
058    public abstract class OutputStream
059      extends java.io.OutputStream
060    {
061      /**
062       * Returns an input stream with the same buffer.
063       * @return an input stream
064       */
065      public abstract InputStream create_input_stream();
066    
067      /**
068       * Return the Object Request Broker that has created this stream.
069       * @return the ORB. This must be overridden, as the default
070       * method always returns null.
071       */
072      public ORB orb()
073      {
074        return null;
075      }
076    
077      /**
078       * Should write an byte (lower 8 bits) to the output stream, but,
079       * following specification, it does not and
080       * must be overridden to get a functionality.
081       *
082       * @param n an integer to write.
083       *
084       * @throws NO_IMPLEMENT, always.
085       * @throws IOException in overriden methods.
086       */
087      public void write(int n)
088                 throws IOException
089      {
090        throw new NO_IMPLEMENT();
091      }
092    
093      /**
094       * Should write a CORBA context to the output stream, but,
095       * following the 1.4 specification, it does not and
096       * must be overridden to get a functionality.
097       *
098       * @throws NO_IMPLEMENT, always.
099       */
100      public void write_Context(Context context, ContextList contexts)
101      {
102        throw new NO_IMPLEMENT();
103      }
104    
105      /**
106       * Write CORBA (not java) Object.
107       */
108      public abstract void write_Object(org.omg.CORBA.Object x);
109    
110      /**
111       * Should write a principal to the output stream, but,
112       * following specification, it does not and
113       * must be overridden to get a functionality.
114       *
115       * @deprecated by CORBA 2.2
116       *
117       * @param principal a Principal to write
118       *
119       * @throws NO_IMPLEMENT, always.
120       */
121      public void write_Principal(Principal principal)
122      {
123        throw new NO_IMPLEMENT();
124      }
125    
126      /**
127       * Write TypeCode.
128       */
129      public abstract void write_TypeCode(TypeCode x);
130    
131      /**
132       * Write CORBA <code>Any</code>.
133       */
134      public abstract void write_any(Any x);
135    
136      /**
137       * Write CORBA <code>boolean</code>.
138       */
139      public abstract void write_boolean(boolean x);
140    
141      /**
142       * Write CORBA <code>booelan[]</code>.
143       */
144      public abstract void write_boolean_array(boolean[] x, int ofs, int len);
145    
146      /**
147       * Write CORBA <code>char</code>.
148       */
149      public abstract void write_char(char x);
150    
151      /**
152       * Write CORBA <code>char[]</code>.
153       */
154      public abstract void write_char_array(char[] chars, int offset, int length);
155    
156      /**
157       * Write CORBA <code>double</code>.
158       */
159      public abstract void write_double(double x);
160    
161      /**
162       * Write CORBA <code>double[]</code>.
163       */
164      public abstract void write_double_array(double[] x, int ofs, int len);
165    
166      /**
167       * Should write a BigDecimal number, but, following specification,
168       * it does not and must be overridden to get a functionality.
169       *
170       * @param fixed a number to write
171       * @throws NO_IMPLEMENT, always.
172       */
173      public void write_fixed(BigDecimal fixed)
174      {
175        throw new NO_IMPLEMENT();
176      }
177    
178      /**
179       * Write CORBA <code>float</code>.
180       */
181      public abstract void write_float(float x);
182    
183      /**
184       * Write CORBA <code>float[]</code>.
185       */
186      public abstract void write_float_array(float[] x, int ofs, int len);
187    
188      /**
189      * Write CORBA <code>long</code> that is mapped into java <code>int</code>.
190      */
191      public abstract void write_long(int x);
192    
193      /**
194       * Write CORBA <code>long[]</code>.
195       */
196      public abstract void write_long_array(int[] x, int ofs, int len);
197    
198      /**
199       * Write CORBA <code>long long</code> that is mapped into
200       * java <code>long</code>.
201       */
202      public abstract void write_longlong(long x);
203    
204      /**
205       * Write CORBA <code>long long []</code>.
206       */
207      public abstract void write_longlong_array(long[] x, int ofs, int len);
208    
209      /**
210       * Write CORBA <code>octed</code> that is mapped into java <code>byte</code>
211       */
212      public abstract void write_octet(byte x);
213    
214      /**
215       * Write CORBA <code>octet[]</code>.
216       */
217      public abstract void write_octet_array(byte[] x, int ofs, int len);
218    
219      /**
220       * Write CORBA <code>short</code>.
221       */
222      public abstract void write_short(short x);
223    
224      /**
225       * Write CORBA <code>short[]</code>.
226       */
227      public abstract void write_short_array(short[] x, int ofs, int len);
228    
229      /**
230       * Write CORBA <code>string</code>.
231       */
232      public abstract void write_string(String x);
233    
234      /**
235       * Write unsigned CORBA <code>long</code> that is mapped into
236       * java <code>int</code>.
237       */
238      public abstract void write_ulong(int x);
239    
240      /**
241       * Write array of CORBA unsigned longs.
242       */
243      public abstract void write_ulong_array(int[] x, int ofs, int len);
244    
245      /**
246       * Write unsigned CORBA <code>long long </code> that is mapped into
247       * java <code>long</code>.
248       */
249      public abstract void write_ulonglong(long x);
250    
251      /**
252       * Write array of unsigned CORBA long-longs.
253       */
254      public abstract void write_ulonglong_array(long[] x, int ofs, int len);
255    
256      /**
257       * Write unsigned CORBA <code>short</code> that is mapped into
258       * java <code>short</code>.
259       */
260      public abstract void write_ushort(short x);
261    
262      /**
263       * Write array of unsigned CORBA shorts.
264       */
265      public abstract void write_ushort_array(short[] x, int ofs, int len);
266    
267      /**
268       * Write CORBA <code>wchar</code> that is mapped into
269       * java <code>char</code>.
270       */
271      public abstract void write_wchar(char x);
272    
273      /**
274       * Write array of CORBA wchars.
275       */
276      public abstract void write_wchar_array(char[] chars, int offset, int length);
277    
278      /**
279       * Write CORBA <code>wstring</code> that is mapped into
280       * java <code>string</code>.
281       */
282      public abstract void write_wstring(String x);
283    }