AbstractDataOutput.java 5.9 KB

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