FSF GCC merge 02/23/03
[official-gcc.git] / libjava / java / io / DataOutput.java
blob2538c32efc1adf83ece3953c74b2e62fbca20a70
1 /* DataOutput.java -- Interface for writing data from a stream
2 Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA.
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.
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. */
39 package java.io;
41 /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
42 * "The Java Language Specification", ISBN 0-201-63451-1
43 * Status: Complete to version 1.1.
46 /**
47 * This interface is implemented by classes that can wrte data to streams
48 * from Java primitive types.
50 * @author Aaron M. Renn (arenn@urbanophile.com)
51 * @author Tom Tromey <tromey@cygnus.com>
53 public interface DataOutput
56 /**
57 * This method writes a Java boolean value to an output stream
59 * @param value The boolean value to write
61 * @exception IOException If an error occurs
63 void
64 writeBoolean(boolean value) throws IOException;
66 /*************************************************************************/
68 /**
69 * This method writes a Java byte value to an output stream
71 * @param value The int value to write
73 * @exception IOException If an error occurs
75 void
76 writeByte(int value) throws IOException;
78 /*************************************************************************/
80 /**
81 * This method writes a Java char value to an output stream
83 * @param value The char value to write
85 * @exception IOException If an error occurs
87 void
88 writeChar(int value) throws IOException;
90 /*************************************************************************/
92 /**
93 * This method writes a Java int value to an output stream as a 16 bit value
95 * @param value The int value to write as a 16-bit value
97 * @exception IOException If an error occurs
99 void
100 writeShort(int value) throws IOException;
102 /*************************************************************************/
105 * This method writes a Java int value to an output stream
107 * @param value The int value to write
109 * @exception IOException If an error occurs
111 void
112 writeInt(int value) throws IOException;
114 /*************************************************************************/
117 * This method writes a Java long value to an output stream
119 * @param value The long value to write
121 * @exception IOException If an error occurs
123 void
124 writeLong(long value) throws IOException;
126 /*************************************************************************/
129 * This method writes a Java float value to an output stream
131 * @param value The float value to write
133 * @exception IOException If an error occurs
135 void
136 writeFloat(float value) throws IOException;
138 /*************************************************************************/
141 * This method writes a Java double value to an output stream
143 * @param value The double value to write
145 * @exception IOException If any other error occurs
147 void
148 writeDouble(double value) throws IOException;
150 /*************************************************************************/
153 * This method writes a String to an output stream as an array of bytes
155 * @param value The String to write
157 * @exception IOException If an error occurs
159 void
160 writeBytes(String value) throws IOException;
162 /*************************************************************************/
165 * This method writes a String to an output stream as an array of char's
167 * @param value The String to write
169 * @exception IOException If an error occurs
171 void
172 writeChars(String value) throws IOException;
174 /*************************************************************************/
177 * This method writes a String to an output stream encoded in
178 * UTF-8 format.
180 * @param value The String to write
182 * @exception IOException If an error occurs
184 void
185 writeUTF(String value) throws IOException;
187 /*************************************************************************/
190 * This method writes an 8-bit value (passed into the method as a Java
191 * int) to an output stream.
193 * @param value The byte to write to the output stream
195 * @exception IOException If an error occurs
197 void
198 write(int value) throws IOException;
200 /*************************************************************************/
203 * This method writes the raw byte array passed in to the output stream.
205 * @param buf The byte array to write
207 * @exception IOException If an error occurs
209 void
210 write(byte[] buf) throws IOException;
212 /*************************************************************************/
215 * This method writes raw bytes from the passed array <code>buf</code> starting
216 * <code>offset</code> bytes into the buffer. The number of bytes written will be
217 * exactly <code>len</code>.
219 * @param buf The buffer from which to write the data
220 * @param offset The offset into the buffer to start writing data from
221 * @param len The number of bytes to write from the buffer to the output stream
223 * @exception IOException If any other error occurs
225 void
226 write(byte[] buf, int offset, int len) throws IOException;
228 } // interface DataOutput