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: XDRDataOutput.java,v $ 023 Revision 1.2 2004/05/05 21:36:35 markl 024 comment block updates 025 026 Revision 1.1 2004/03/15 06:12:16 markl 027 New classes. 028 ---------------------------------------------------------------------------- 029*/ 030 031package kiwi.io; 032 033import java.io.*; 034 035/** 036 * An interface for encoding various datatypes to XDR. 037 * 038 * @author Mark Lindner 039 * @since Kiwi 2.0 040 */ 041 042public interface XDRDataOutput 043 { 044 045 /** 046 * Write a boolean value. 047 */ 048 049 public void writeBoolean(boolean value) throws IOException; 050 051 /** 052 * Write a character (8-bit integer) value. 053 */ 054 055 public void writeChar(char value) throws IOException; 056 057 /** 058 * Write a short (16-bit integer) value. 059 */ 060 061 public void writeShort(short value) throws IOException; 062 063 /** 064 * Write an unsigned short (unsigned 16-bit integer value, represented by 065 * a Java <tt>init</tt>. 066 */ 067 068 public void writeUnsignedShort(int value) throws IOException; 069 070 /** 071 ** Write an int (32-bit integer) value. 072 */ 073 074 public void writeInt(int value) throws IOException; 075 076 /** 077 * Write an unsigned integer value (represented by a 64-bit signed Java 078 * <tt>long</tt). 079 */ 080 081 public void writeUnsignedInt(long value) throws IOException; 082 083 /** 084 * Write a long (64-bit integer) value. 085 */ 086 087 public void writeLong(long value) throws IOException; 088 089 /** 090 * Write a float value. 091 */ 092 093 public void writeFloat(float value) throws IOException; 094 095 /** 096 * Write a double value. 097 */ 098 099 public void writeDouble(double value) throws IOException; 100 101 /** 102 * Write a fixed-length string. 103 */ 104 105 public void writeString(String string) throws IOException; 106 107 /** 108 * Write a variable-length array of <tt>boolean</tt> values. 109 */ 110 111 public void writeBooleanArray(boolean[] array) throws IOException; 112 113 /** 114 * Write a variable-length array of <tt>boolean</tt>values. 115 * 116 * @param array The array of values. 117 * @param offset The index of the first element to write. 118 * @param length The number of elements to write. 119 */ 120 121 public void writeBooleanArray(boolean[] array, int offset, int length) 122 throws IOException; 123 124 /** 125 * Write a fixed-length array of <tt>boolean</tt> values. 126 */ 127 128 public void writeBooleanVector(boolean[] array) throws IOException; 129 130 /** 131 * Write a fixed-length array of <tt>boolean</tt> values. 132 * 133 * @param array The array of values. 134 * @param offset The index of the first element to write. 135 * @param length The number of elements to write. 136 */ 137 138 public void writeBooleanVector(boolean[] array, int offset, int length) 139 throws IOException; 140 141 /** 142 * Write a variable-length array of bytes. 143 */ 144 145 public void writeByteArray(byte[] array) throws IOException; 146 147 /** 148 * Write a variable-length array of bytes. 149 * 150 * @param array The array of bytes. 151 * @param offset The index of the first bytes to write. 152 * @param length The number of bytes to write. 153 */ 154 155 public void writeByteArray(byte[] array, int offset, int length) 156 throws IOException; 157 158 /** 159 * Write a fixed-length array of bytes. 160 */ 161 162 public void writeByteVector(byte[] array) throws IOException; 163 164 /** 165 * Write a fixed-length array of bytes. 166 * 167 * @param array The array of bytes. 168 * @param offset The index of the first bytes to write. 169 * @param length The number of bytes to write. 170 */ 171 172 public void writeByteVector(byte[] array, int offset, int length) 173 throws IOException; 174 175 /** 176 * Write a variable-length array of <tt>short</tt> values (16-bit integers). 177 */ 178 179 public void writeShortArray(short[] array) throws IOException; 180 181 /** 182 * Write a variable-length array of <tt>short</tt> values (16-bit integers). 183 * 184 * @param array The array of values. 185 * @param offset The index of the first element to write. 186 * @param length The number of elements to write. 187 */ 188 189 public void writeShortArray(short[] array, int offset, int length) 190 throws IOException; 191 192 /** 193 * Write a fixed-length array of <tt>short</tt> values (16-bit integers). 194 */ 195 196 public void writeShortVector(short[] array) throws IOException; 197 198 /** 199 * Write a fixed-length array of <tt>short</tt> values (16-bit integers). 200 * 201 * @param array The array of values. 202 * @param offset The index of the first element to write. 203 * @param length The number of elements to write. 204 */ 205 206 public void writeShortVector(short[] array, int offset, int length) 207 throws IOException; 208 209 /** 210 * Write a variable-length array of <tt>unsigned short</tt> values 211 * (16-bit unsigned integers, represented by 32-bit signed Java 212 * <tt>int</tt>s). 213 */ 214 215 public void writeUnsignedShortArray(int[] array) throws IOException; 216 217 /** 218 * Write a variable-length array of <tt>unsigned short</tt> values 219 * (16-bit unsigned integers, represented by 32-bit signed Java 220 * <tt>int</tt>s). 221 * 222 * @param array The array of values. 223 * @param offset The index of the first element to write. 224 * @param length The number of elements to write. 225 */ 226 227 public void writeUnsignedShortArray(int[] array, int offset, int length) 228 throws IOException; 229 230 /** 231 * Write a fixed-length array of <tt>unsigned short</tt> values 232 * (16-bit unsigned integers, represented by 32-bit signed Java 233 * <tt>int</tt>s). 234 */ 235 236 public void writeUnsignedShortVector(int[] array) throws IOException; 237 238 /** 239 * Write a fixed-length array of <tt>unsigned short</tt> values 240 * (16-bit unsigned integers, represented by 32-bit signed Java 241 * <tt>int</tt>s). 242 * 243 * @param array The array of values. 244 * @param offset The index of the first element to write. 245 * @param length The number of elements to write. 246 */ 247 248 public void writeUnsignedShortVector(int[] array, int offset, int length) 249 throws IOException; 250 251 /** 252 * Write a variable-length array of <tt>int</tt> values (32-bit integers). 253 */ 254 255 public void writeIntArray(int[] array) throws IOException; 256 257 /** 258 * Write a variable-length array of <tt>int</tt> values (32-bit integers). 259 * 260 * @param array The array of values. 261 * @param offset The index of the first element to write. 262 * @param length The number of elements to write. 263 */ 264 265 public void writeIntArray(int[] array, int offset, int length) 266 throws IOException; 267 268 /** 269 * Write a fixed-length array of <tt>int</tt> values (32-bit integers). 270 */ 271 272 public void writeIntVector(int[] array) throws IOException; 273 274 /** 275 * Write a fixed-length array of <tt>int</tt> values (32-bit integers). 276 * 277 * @param array The array of values. 278 * @param offset The index of the first element to write. 279 * @param length The number of elements to write. 280 */ 281 282 public void writeIntVector(int[] array, int offset, int length) 283 throws IOException; 284 285 /** 286 * Write a variable-length array of <tt>unsigned int</tt> values (32-bit 287 * unsigned integers, represented as Java <tt>long</tt> values). 288 */ 289 290 public void writeUnsignedIntArray(long[] array) throws IOException; 291 292 /** 293 * Write a variable-length array of <tt>unsigned int</tt> values (32-bit 294 * unsigned integers, represented as Java <tt>long</tt> values). 295 * 296 * @param array The array of values. 297 * @param offset The index of the first element to write. 298 * @param length The number of elements to write. 299 */ 300 301 public void writeUnsignedIntArray(long[] array, int offset, int length) 302 throws IOException; 303 304 /** 305 * Write a fixed-length array of <tt>unsigned int</tt> values (32-bit 306 * unsigned integers, represented as Java <tt>long</tt> values). 307 */ 308 309 public void writeUnsignedIntVector(long[] array) throws IOException; 310 311 /** 312 * Write a fixed-length array of <tt>unsigned int</tt> values (32-bit 313 * unsigned integers, represented as Java <tt>long</tt> values). 314 * 315 * @param array The array of values. 316 * @param offset The index of the first element to write. 317 * @param length The number of elements to write. 318 */ 319 320 public void writeUnsignedIntVector(long[] array, int offset, int length) 321 throws IOException; 322 323 /** 324 * Write a variable-length array of <tt>long</tt> values (64-bit integers). 325 */ 326 327 public void writeLongArray(long[] array) throws IOException; 328 329 /** 330 * Write a variable-length array of <tt>long</tt> values (64-bit integers). 331 * 332 * @param array The array of values. 333 * @param offset The index of the first element to write. 334 * @param length The number of elements to write. 335 * 336 */ 337 338 public void writeLongArray(long[] array, int offset, int length) 339 throws IOException; 340 341 /** 342 * Write a fixed-length array of <tt>long</tt> values (64-bit integers). 343 */ 344 345 public void writeLongVector(long[] array) throws IOException; 346 347 /** 348 * Write a fixed-length array of <tt>long</tt> values (64-bit integers). 349 * 350 * @param array The array of values. 351 * @param offset The index of the first element to write. 352 * @param length The number of elements to write. 353 */ 354 355 public void writeLongVector(long[] array, int offset, int length) 356 throws IOException; 357 358 /** 359 * Write a variable-length array of <tt>float</tt> values. 360 */ 361 362 public void writeFloatArray(float[] array) throws IOException; 363 364 /** 365 * Write a variable-length array of <tt>float</tt> values. 366 * 367 * @param array The array of values. 368 * @param offset The index of the first element to write. 369 * @param length The number of elements to write. 370 */ 371 372 public void writeFloatArray(float[] array, int offset, int length) 373 throws IOException; 374 375 /** 376 * Write a fixed-length array of <tt>double</tt> values. 377 */ 378 379 public void writeFloatVector(float[] array) throws IOException; 380 381 /** 382 * Write a fixed-length array of <tt>double</tt> values. 383 * 384 * @param array The array of values. 385 * @param offset The index of the first element to write. 386 * @param length The number of elements to write. 387 */ 388 389 public void writeFloatVector(float[] array, int offset, int length) 390 throws IOException; 391 392 /** 393 * Write a variable-length array of <tt>double</tt> values. 394 */ 395 396 public void writeDoubleArray(double[] array) throws IOException; 397 398 /** 399 * Write a variable-length array of <tt>double</tt> values. 400 * 401 * @param array The array of values. 402 * @param offset The index of the first element to write. 403 * @param length The number of elements to write. 404 */ 405 406 public void writeDoubleArray(double[] array, int offset, int length) 407 throws IOException; 408 409 /** 410 * Write a fixed-length array of <tt>double</tt> values. 411 */ 412 413 public void writeDoubleVector(double[] array) throws IOException; 414 415 /** 416 * Write a fixed-length array of <tt>double</tt> values. 417 * 418 * @param array The array of values. 419 * @param offset The index of the first element to write. 420 * @param length The number of elements to write. 421 */ 422 423 public void writeDoubleVector(double[] array, int offset, int length) 424 throws IOException; 425} 426 427/* end of source file */