CDRInputStreamBase.java revision 608:7e06bf1dcb09
1/*
2 * Copyright (c) 2000, 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 */
25package com.sun.corba.se.impl.encoding;
26
27import java.io.IOException;
28import java.io.Serializable;
29import java.math.BigDecimal;
30import java.nio.ByteBuffer;
31
32import org.omg.CORBA.TypeCode;
33import org.omg.CORBA.Principal;
34import org.omg.CORBA.Any;
35
36import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
37import com.sun.corba.se.impl.orbutil.ORBConstants;
38import com.sun.org.omg.SendingContext.CodeBase;
39
40/**
41 * Describes CDRInputStream delegates and provides some
42 * implementation.  Non-default constructors are avoided in
43 * the delegation to separate instantiation from initialization,
44 * so we use init methods.
45 */
46abstract class CDRInputStreamBase extends java.io.InputStream
47{
48    protected CDRInputStream parent;
49
50    public void setParent(CDRInputStream parent) {
51        this.parent = parent;
52    }
53
54    public abstract void init(org.omg.CORBA.ORB orb,
55                              ByteBuffer byteBuffer,
56                              int size,
57                              boolean littleEndian,
58                              BufferManagerRead bufferManager);
59
60    // org.omg.CORBA.portable.InputStream
61    public abstract boolean read_boolean();
62    public abstract char read_char();
63    public abstract char read_wchar();
64    public abstract byte read_octet();
65    public abstract short read_short();
66    public abstract short read_ushort();
67    public abstract int read_long();
68    public abstract int read_ulong();
69    public abstract long read_longlong();
70    public abstract long read_ulonglong();
71    public abstract float read_float();
72    public abstract double read_double();
73    public abstract String read_string();
74    public abstract String read_wstring();
75    public abstract void read_boolean_array(boolean[] value, int offset, int length);
76    public abstract void read_char_array(char[] value, int offset, int length);
77    public abstract void read_wchar_array(char[] value, int offset, int length);
78    public abstract void read_octet_array(byte[] value, int offset, int length);
79    public abstract void read_short_array(short[] value, int offset, int length);
80    public abstract void read_ushort_array(short[] value, int offset, int length);
81    public abstract void read_long_array(int[] value, int offset, int length);
82    public abstract void read_ulong_array(int[] value, int offset, int length);
83    public abstract void read_longlong_array(long[] value, int offset, int length);
84    public abstract void read_ulonglong_array(long[] value, int offset, int length);
85    public abstract void read_float_array(float[] value, int offset, int length);
86    public abstract void read_double_array(double[] value, int offset, int length);
87    public abstract org.omg.CORBA.Object read_Object();
88    public abstract TypeCode read_TypeCode();
89    public abstract Any read_any();
90    public abstract Principal read_Principal();
91    public int read() throws java.io.IOException {
92        throw new org.omg.CORBA.NO_IMPLEMENT();
93    }
94    public abstract java.math.BigDecimal read_fixed();
95    public org.omg.CORBA.Context read_Context() {
96        throw new org.omg.CORBA.NO_IMPLEMENT();
97    }
98    public abstract org.omg.CORBA.Object read_Object(java.lang.Class clz);
99    public abstract org.omg.CORBA.ORB orb();
100
101    // org.omg.CORBA_2_3.portable.InputStream
102    public abstract java.io.Serializable read_value();
103    public abstract java.io.Serializable read_value(java.lang.Class clz);
104    public abstract java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper factory);
105    public abstract java.io.Serializable read_value(java.lang.String rep_id);
106    public abstract java.io.Serializable read_value(java.io.Serializable value);
107    public abstract java.lang.Object read_abstract_interface();
108    public abstract java.lang.Object read_abstract_interface(java.lang.Class clz);
109
110    // com.sun.corba.se.impl.encoding.MarshalInputStream
111    public abstract void consumeEndian();
112    public abstract int getPosition();
113
114    // org.omg.CORBA.DataInputStream
115    public abstract java.lang.Object read_Abstract ();
116    public abstract java.io.Serializable read_Value ();
117    public abstract void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length);
118    public abstract void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length);
119    public abstract void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length);
120    public abstract void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length);
121    public abstract void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length);
122    public abstract void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length);
123    public abstract void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length);
124    public abstract void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length);
125    public abstract void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length);
126    public abstract void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length);
127    public abstract void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length);
128    public abstract void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length);
129    public abstract void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length);
130
131    // org.omg.CORBA.portable.ValueBase
132    public abstract String[] _truncatable_ids();
133
134    // java.io.InputStream
135    // REVISIT - should we make these throw UnsupportedOperationExceptions?
136    // Right now, they'll go up to the java.io versions!
137
138//     public abstract int read(byte b[]) throws IOException;
139//     public abstract int read(byte b[], int off, int len) throws IOException
140//     public abstract long skip(long n) throws IOException;
141//     public abstract int available() throws IOException;
142//     public abstract void close() throws IOException;
143    public abstract void mark(int readlimit);
144    public abstract void reset();
145
146    // This should return false so that outside users (people using the JDK)
147    // don't have any guarantees that mark/reset will work in their
148    // custom marshaling code.  This is necessary since they could do things
149    // like expect obj1a == obj1b in the following code:
150    //
151    // is.mark(10000);
152    // Object obj1a = is.readObject();
153    // is.reset();
154    // Object obj1b = is.readObject();
155    //
156    public boolean markSupported() { return false; }
157
158    // Needed by AnyImpl and ServiceContexts
159    public abstract CDRInputStreamBase dup();
160
161    // Needed by TCUtility
162    public abstract java.math.BigDecimal read_fixed(short digits, short scale);
163
164    // Needed by TypeCodeImpl
165    public abstract boolean isLittleEndian();
166
167    // Needed by request and reply messages for GIOP versions >= 1.2 only.
168    abstract void setHeaderPadding(boolean headerPadding);
169
170    // Needed by IIOPInputStream and other subclasses
171
172    public abstract ByteBuffer getByteBuffer();
173    public abstract void setByteBuffer(ByteBuffer byteBuffer);
174
175    public abstract void setByteBufferWithInfo(ByteBufferWithInfo bbwi);
176
177    public abstract int getBufferLength();
178    public abstract void setBufferLength(int value);
179
180    public abstract int getIndex();
181    public abstract void setIndex(int value);
182
183    public abstract void orb(org.omg.CORBA.ORB orb);
184
185    public abstract BufferManagerRead getBufferManager();
186    public abstract GIOPVersion getGIOPVersion();
187
188    abstract CodeBase getCodeBase();
189
190    abstract void printBuffer();
191
192    abstract void alignOnBoundary(int octetBoundary);
193
194    abstract void performORBVersionSpecificInit();
195
196    public abstract void resetCodeSetConverters();
197
198    // ValueInputStream -------------------------
199    public abstract void start_value();
200    public abstract void end_value();
201}
202