001/* ----------------------------------------------------------------------------
002   The Kiwi Toolkit - A Java Class Library
003   Copyright (C) 1998-2004 Mark A. Lindner
004
005   This library is free software; you can redistribute it and/or
006   modify it under the terms of the GNU General Public License as
007   published by the Free Software Foundation; either version 2 of the
008   License, or (at your option) any later version.
009
010   This library is distributed in the hope that it will be useful,
011   but WITHOUT ANY WARRANTY; without even the implied warranty of
012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013   General Public License for more details.
014
015   You should have received a copy of the GNU General Public License
016   along with this library; if not, write to the Free Software
017   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
018   02111-1307, USA.
019 
020   The author may be contacted at: mark_a_lindner@yahoo.com
021   ----------------------------------------------------------------------------
022   $Log: XDRDataInput.java,v $
023   Revision 1.3  2004/05/05 21:36:35  markl
024   comment block updates
025
026   Revision 1.2  2004/03/16 07:31:25  markl
027   Javadoc added.
028
029   Revision 1.1  2004/03/15 06:12:16  markl
030   New classes.
031   ----------------------------------------------------------------------------
032*/
033
034package kiwi.io;
035
036import java.io.*;
037
038/**
039 * An interface for decoding various datatypes from XDR.
040 *
041 * @author Mark Lindner
042 * @since Kiwi 2.0
043 */
044
045public interface XDRDataInput
046  {
047
048  /**
049   * Read a boolean value.
050   */
051
052  public boolean readBoolean() throws IOException;
053
054  /**
055   * Read a character (8-bit integer) value.
056   */
057  
058  public char readChar() throws IOException;
059  
060  /**
061   * Read a short (16-bit integer) value.
062   */
063  
064  public short readShort() throws IOException;
065
066  /**
067   * Read an unsigned short (unsigned 16-bit integer value, coerced to a Java
068   * <tt>int</tt>).
069   */
070
071  public int readUnsignedShort() throws IOException;
072
073  /**
074   * Read an int (32-bit integer) value.
075   */
076
077  public int readInt() throws IOException;
078
079  /**
080   * Read an unsigned integer value (coerced to a 64-bit signed Java
081   * <tt>long</tt>).
082   */
083
084  public long readUnsignedInt() throws IOException;
085  
086  /**
087   * Read a long (64-bit integer) value.
088   */
089
090  public long readLong() throws IOException;
091
092  /**
093   * Read a float value.
094   */
095
096  public float readFloat() throws IOException;
097
098  /**
099   * Read a double value.
100   */
101
102  public double readDouble() throws IOException;
103
104  /**
105   * Read a variable-length string.
106   */
107  
108  public String readString() throws IOException;
109  
110  /**
111   * Read a fixed-length string.
112   *
113   * @param length The length of the string.
114   */
115  
116  public String readString(int length) throws IOException;
117
118  /**
119   * Read a variable-length array of <tt>boolean</tt> values.
120   */
121  
122  public boolean[] readBooleanArray() throws IOException;
123
124  /**
125   * Read a fixed-length array of <tt>boolean</tt> values.
126   *
127   * @param array The array to read into.
128   */
129
130  public void readBooleanVector(boolean[] array) throws IOException;
131
132  /**
133   * Read a fixed-length array of <tt>boolean</tt> values.
134   *
135   * @param array The array to read into.
136   * @param offset The offset in the array in which to begin storing values.
137   * @param length The number of values to read.
138   */
139
140  public void readBooleanVector(boolean[] array, int offset, int length)
141    throws IOException;
142
143  /**
144   * Read a variable-length array of bytes.
145   */
146
147  public byte[] readByteArray() throws IOException;
148
149  /**
150   * Read a fixed-length array of bytes.
151   *
152   * @param array The array to read into.
153   */
154  
155  public void readByteVector(byte[] array) throws IOException;
156
157  /**
158   * Read a fxied-length array of bytes.
159   *
160   * @param array The array to read into.
161   * @param offset The offset in the array in which to begin storing values.
162   * @param length The number of values to read.
163   */
164  
165  public void readByteVector(byte[] array, int offset, int length)
166    throws IOException;  
167  
168  /**
169   * Read a variable-length array of <tt>short</tt> values (16-bit integers).
170   */
171  
172  public short[] readShortArray() throws IOException;
173
174  /**
175   * Read a fixed-length array of <tt>short</tt> values (16-bit integers).
176   *
177   * @param array The array to read into.
178   */
179  
180  public void readShortVector(short[] array) throws IOException;
181
182  /**
183   * Read a fixed-length array of <tt>short</tt> values (16-bit integers).
184   *
185   * @param array The array to read into.
186   * @param offset The offset in the array in which to begin storing values.
187   * @param length The number of values to read.
188   */
189  
190  public void readShortVector(short[] array, int offset, int length)
191    throws IOException;
192  
193  /**
194   * Read a variable-length array of <tt>unsigned short</tt> values
195   * (16-bit unsigned integers, coerced to 32-bit signed Java <tt>int</tt>s).
196   */
197
198  public int[] readUnsignedShortArray() throws IOException;
199  
200  /**
201   * Read a fixed-length array of <tt>unsigned short</tt> values
202   * (16-bit unsigned integers, coerced to 32-bit signed Java <tt>int</tt>s).
203   *
204   * @param array The array to read into.   
205   */
206  
207  public void readUnsignedShortVector(int[] array) throws IOException;
208
209  /**
210   * Read a fixed-length array of <tt>unsigned short</tt> values
211   * (16-bit unsigned integers, coerced to 32-bit signed Java <tt>int</tt>s).
212   *
213   * @param array The array to read into.
214   * @param offset The offset in the array in which to begin storing values.
215   * @param length The number of values to read.
216   */
217  
218  public void readUnsignedShortVector(int[] array, int offset, int length)
219    throws IOException;
220  
221  /**
222   * Read a variable-length array of <tt>int</tt> values (32-bit integers).
223   */
224  
225  public int[] readIntArray() throws IOException;
226  
227  /**
228   * Read a fixed-length array of <tt>int</tt> values (32-bit integers).
229   *
230   * @param array The array to read into.   
231   */
232
233  public void readIntVector(int[] array) throws IOException;
234
235  /**
236   * Read a fixed-length array of <tt>int</tt> values (32-bit integers).
237   *
238   * @param array The array to read into.
239   * @param offset The offset in the array in which to begin storing values.
240   * @param length The number of values to read.
241   */
242  
243  public void readIntVector(int[] array, int offset, int length)
244    throws IOException;
245  
246  /**
247   * Read a variable-length array of <tt>unsigned int</tt> values (32-bit
248   * unsigned integers, coerced to 64-bit signed Java <tt>long</tt>s).
249   */
250
251  public long[] readUnsignedIntArray() throws IOException;
252
253  /**
254   * Read a fixed-length array of <tt>unsigned int</tt> values (32-bit
255   * unsigned integers, coerced to 64-bit signed Java <tt>long</tt>s).
256   *
257   * @param array The array to read into.   
258   */
259  
260  public void readUnsignedIntVector(long[] array) throws IOException;
261
262  /**
263   * Read a fixed-length array of <tt>unsigned int</tt> values (32-bit
264   * unsigned integers, coerced to 64-bit signed Java <tt>long</tt>s).
265   *
266   * @param array The array to read into.
267   * @param offset The offset in the array in which to begin storing values.
268   * @param length The number of values to read.
269   */
270  
271  public void readUnsignedIntVector(long[] array, int offset, int length)
272    throws IOException;
273  
274  /**
275   * Read a variable-length array of <tt>long</tt> values (64-bit integers).
276   */
277  
278  public long[] readLongArray() throws IOException;
279
280  /**
281   * Read a fixed-length array of <tt>long</tt> values (64-bit integers).
282   *
283   * @param array The array to read into.   
284   */
285
286  public void readLongVector(long[] array) throws IOException;
287
288  /**
289   * Read a variable-length array of <tt>long</tt> values (64-bit integers).
290   * 
291   * @param array The array to read into.
292   * @param offset The offset in the array in which to begin storing values.
293   * @param length The number of values to read.
294   */
295  
296  public void readLongVector(long[] array, int offset, int length)
297    throws IOException;
298  
299  /**
300   * Read a variable-length array of <tt>float</tt> values.
301   */
302  
303  public float[] readFloatArray() throws IOException;
304
305  /**
306   * Read a fixed-length array of <tt>float</tt> values.
307   *
308   * @param array The array to read into.
309   */
310
311  public void readFloatVector(float[] array) throws IOException;
312
313  /**
314   * Read a fixed-length array of <tt>float</tt> values.
315   *
316   * @param array The array to read into.
317   * @param offset The offset in the array in which to begin storing values.
318   * @param length The number of values to read.
319   */
320
321  public void readFloatVector(float[] array, int offset, int length)
322    throws IOException;
323  
324  /**
325   * Read a variable-length array of <tt>double</tt> values.
326   */
327  
328  public double[] readDoubleArray() throws IOException;
329
330  /**
331   * Read a fixed-length array of <tt>double</tt> values.
332   *
333   * @param array The array to read into.
334   */
335
336  public void readDoubleVector(double[] array) throws IOException;
337
338  /**
339   * Read a fixed-length array of <tt>double</tt> values.
340   *
341   * @param array The array to read into.
342   * @param offset The offset in the array in which to begin storing values.
343   * @param length The number of values to read.
344   */
345  
346  public void readDoubleVector(double[] array, int offset, int length)
347    throws IOException;
348  }
349
350/* end of source file */