Frames | No Frames |
1: /* AbstractDataOutput.java -- 2: Copyright (C) 2005 Free Software Foundation, Inc. 3: 4: This file is part of GNU Classpath. 5: 6: GNU Classpath is free software; you can redistribute it and/or modify 7: it under the terms of the GNU General Public License as published by 8: the Free Software Foundation; either version 2, or (at your option) 9: any later version. 10: 11: GNU Classpath is distributed in the hope that it will be useful, but 12: WITHOUT ANY WARRANTY; without even the implied warranty of 13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14: General Public License for more details. 15: 16: You should have received a copy of the GNU General Public License 17: along with GNU Classpath; see the file COPYING. If not, write to the 18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19: 02110-1301 USA. 20: 21: Linking this library statically or dynamically with other modules is 22: making a combined work based on this library. Thus, the terms and 23: conditions of the GNU General Public License cover the whole 24: combination. 25: 26: As a special exception, the copyright holders of this library give you 27: permission to link this library with independent modules to produce an 28: executable, regardless of the license terms of these independent 29: modules, and to copy and distribute the resulting executable under 30: terms of your choice, provided that you also meet, for each linked 31: independent module, the terms and conditions of the license of that 32: module. An independent module is a module which is not derived from 33: or based on this library. If you modify this library, you may extend 34: this exception to your version of the library, but you are not 35: obligated to do so. If you do not wish to do so, delete this 36: exception statement from your version. */ 37: 38: 39: package gnu.CORBA.CDR; 40: 41: import java.io.IOException; 42: 43: /** 44: * An abstract data output stream that could write data in either 45: * Big Endian or Little Endian format. 46: * 47: * This class reuses code from GNU Classpath DataOutputStream. 48: * 49: * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) 50: * @author Warren Levy (warrenl@cygnus.com) 51: * @author Aaron M. Renn (arenn@urbanophile.com) 52: */ 53: public interface AbstractDataOutput 54: { 55: /** 56: * This method flushes any unwritten bytes to the underlying stream. 57: * 58: * @exception IOException If an error occurs. 59: */ 60: void flush() 61: throws IOException; 62: 63: /** 64: * This method writes the specified byte (passed as an <code>int</code>) 65: * to the underlying output stream. 66: * 67: * @param value The <code>byte</code> to write, passed as an <code>int</code>. 68: * 69: * @exception IOException If an error occurs. 70: */ 71: void write(int value) 72: throws IOException; 73: 74: /** 75: * This method writes <code>len</code> bytes from the specified byte array 76: * <code>buf</code> starting at position <code>offset</code> into the 77: * buffer to the underlying output stream. 78: * 79: * @param buf The byte array to write from. 80: * @param offset The index into the byte array to start writing from. 81: * @param len The number of bytes to write. 82: * 83: * @exception IOException If an error occurs. 84: */ 85: void write(byte[] buf, int offset, int len) 86: throws IOException; 87: 88: /** 89: * Write the complete byte array. 90: * @throws IOException 91: */ 92: void write(byte[] buf) 93: throws IOException; 94: 95: /** 96: * This method writes a Java boolean value to an output stream. If 97: * <code>value</code> is <code>true</code>, a byte with the value of 98: * 1 will be written, otherwise a byte with the value of 0 will be 99: * written. 100: * 101: * The value written can be read using the <code>readBoolean</code> 102: * method in <code>DataInput</code>. 103: * 104: * @param value The <code>boolean</code> value to write to the stream 105: * 106: * @exception IOException If an error occurs 107: */ 108: void writeBoolean(boolean value) 109: throws IOException; 110: 111: /** 112: * This method writes a Java byte value to an output stream. The 113: * byte to be written will be in the lowest 8 bits of the 114: * <code>int</code> value passed. 115: * 116: * The value written can be read using the <code>readByte</code> or 117: * <code>readUnsignedByte</code> methods in <code>DataInput</code>. 118: * 119: * @param value The <code>byte</code> to write to the stream, passed as 120: * the low eight bits of an <code>int</code>. 121: * 122: * @exception IOException If an error occurs 123: */ 124: void writeByte(int value) 125: throws IOException; 126: 127: /** 128: * This method writes a Java short value to an output stream. The 129: * char to be written will be in the lowest 16 bits of the <code>int</code> 130: * value passed. 131: * 132: * @exception IOException If an error occurs 133: */ 134: void writeShort(int value) 135: throws IOException; 136: 137: /** 138: * This method writes a Java char value to an output stream. The 139: * char to be written will be in the lowest 16 bits of the <code>int</code> 140: * value passed. 141: * 142: * @exception IOException If an error occurs 143: */ 144: void writeChar(int value) 145: throws IOException; 146: 147: /** 148: * This method writes a Java int value to an output stream. 149: * 150: * @param value The <code>int</code> value to write to the stream 151: * 152: * @exception IOException If an error occurs 153: */ 154: void writeInt(int value) 155: throws IOException; 156: 157: /** 158: * This method writes a Java long value to an output stream. 159: * 160: * @param value The <code>long</code> value to write to the stream 161: * 162: * @exception IOException If an error occurs 163: */ 164: void writeLong(long value) 165: throws IOException; 166: 167: /** 168: * This method writes a Java <code>float</code> value to the stream. 169: * @param value The <code>float</code> value to write to the stream 170: * 171: * @exception IOException If an error occurs 172: */ 173: void writeFloat(float value) 174: throws IOException; 175: 176: /** 177: * This method writes a Java <code>double</code> value to the stream. 178: * 179: * @param value The <code>double</code> value to write to the stream 180: * 181: * @exception IOException If an error occurs 182: */ 183: void writeDouble(double value) 184: throws IOException; 185: }