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