1 | /* DataOutput.java -- Interface for writing data from a stream
|
---|
2 | Copyright (C) 1998, 1999, 2001 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., 59 Temple Place, Suite 330, Boston, MA
|
---|
19 | 02111-1307 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 java.io;
|
---|
40 |
|
---|
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.
|
---|
44 | */
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * This interface is implemented by classes that can wrte data to streams
|
---|
48 | * from Java primitive types.
|
---|
49 | *
|
---|
50 | * @author Aaron M. Renn (arenn@urbanophile.com)
|
---|
51 | * @author Tom Tromey <tromey@cygnus.com>
|
---|
52 | */
|
---|
53 | public interface DataOutput
|
---|
54 | {
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * This method writes a Java boolean value to an output stream
|
---|
58 | *
|
---|
59 | * @param value The boolean value to write
|
---|
60 | *
|
---|
61 | * @exception IOException If an error occurs
|
---|
62 | */
|
---|
63 | void
|
---|
64 | writeBoolean(boolean value) throws IOException;
|
---|
65 |
|
---|
66 | /*************************************************************************/
|
---|
67 |
|
---|
68 | /**
|
---|
69 | * This method writes a Java byte value to an output stream
|
---|
70 | *
|
---|
71 | * @param value The int value to write
|
---|
72 | *
|
---|
73 | * @exception IOException If an error occurs
|
---|
74 | */
|
---|
75 | void
|
---|
76 | writeByte(int value) throws IOException;
|
---|
77 |
|
---|
78 | /*************************************************************************/
|
---|
79 |
|
---|
80 | /**
|
---|
81 | * This method writes a Java char value to an output stream
|
---|
82 | *
|
---|
83 | * @param value The char value to write
|
---|
84 | *
|
---|
85 | * @exception IOException If an error occurs
|
---|
86 | */
|
---|
87 | void
|
---|
88 | writeChar(int value) throws IOException;
|
---|
89 |
|
---|
90 | /*************************************************************************/
|
---|
91 |
|
---|
92 | /**
|
---|
93 | * This method writes a Java int value to an output stream as a 16 bit value
|
---|
94 | *
|
---|
95 | * @param value The int value to write as a 16-bit value
|
---|
96 | *
|
---|
97 | * @exception IOException If an error occurs
|
---|
98 | */
|
---|
99 | void
|
---|
100 | writeShort(int value) throws IOException;
|
---|
101 |
|
---|
102 | /*************************************************************************/
|
---|
103 |
|
---|
104 | /**
|
---|
105 | * This method writes a Java int value to an output stream
|
---|
106 | *
|
---|
107 | * @param value The int value to write
|
---|
108 | *
|
---|
109 | * @exception IOException If an error occurs
|
---|
110 | */
|
---|
111 | void
|
---|
112 | writeInt(int value) throws IOException;
|
---|
113 |
|
---|
114 | /*************************************************************************/
|
---|
115 |
|
---|
116 | /**
|
---|
117 | * This method writes a Java long value to an output stream
|
---|
118 | *
|
---|
119 | * @param value The long value to write
|
---|
120 | *
|
---|
121 | * @exception IOException If an error occurs
|
---|
122 | */
|
---|
123 | void
|
---|
124 | writeLong(long value) throws IOException;
|
---|
125 |
|
---|
126 | /*************************************************************************/
|
---|
127 |
|
---|
128 | /**
|
---|
129 | * This method writes a Java float value to an output stream
|
---|
130 | *
|
---|
131 | * @param value The float value to write
|
---|
132 | *
|
---|
133 | * @exception IOException If an error occurs
|
---|
134 | */
|
---|
135 | void
|
---|
136 | writeFloat(float value) throws IOException;
|
---|
137 |
|
---|
138 | /*************************************************************************/
|
---|
139 |
|
---|
140 | /**
|
---|
141 | * This method writes a Java double value to an output stream
|
---|
142 | *
|
---|
143 | * @param value The double value to write
|
---|
144 | *
|
---|
145 | * @exception IOException If any other error occurs
|
---|
146 | */
|
---|
147 | void
|
---|
148 | writeDouble(double value) throws IOException;
|
---|
149 |
|
---|
150 | /*************************************************************************/
|
---|
151 |
|
---|
152 | /**
|
---|
153 | * This method writes a String to an output stream as an array of bytes
|
---|
154 | *
|
---|
155 | * @param value The String to write
|
---|
156 | *
|
---|
157 | * @exception IOException If an error occurs
|
---|
158 | */
|
---|
159 | void
|
---|
160 | writeBytes(String value) throws IOException;
|
---|
161 |
|
---|
162 | /*************************************************************************/
|
---|
163 |
|
---|
164 | /**
|
---|
165 | * This method writes a String to an output stream as an array of char's
|
---|
166 | *
|
---|
167 | * @param value The String to write
|
---|
168 | *
|
---|
169 | * @exception IOException If an error occurs
|
---|
170 | */
|
---|
171 | void
|
---|
172 | writeChars(String value) throws IOException;
|
---|
173 |
|
---|
174 | /*************************************************************************/
|
---|
175 |
|
---|
176 | /**
|
---|
177 | * This method writes a String to an output stream encoded in
|
---|
178 | * UTF-8 format.
|
---|
179 | *
|
---|
180 | * @param value The String to write
|
---|
181 | *
|
---|
182 | * @exception IOException If an error occurs
|
---|
183 | */
|
---|
184 | void
|
---|
185 | writeUTF(String value) throws IOException;
|
---|
186 |
|
---|
187 | /*************************************************************************/
|
---|
188 |
|
---|
189 | /**
|
---|
190 | * This method writes an 8-bit value (passed into the method as a Java
|
---|
191 | * int) to an output stream.
|
---|
192 | *
|
---|
193 | * @param value The byte to write to the output stream
|
---|
194 | *
|
---|
195 | * @exception IOException If an error occurs
|
---|
196 | */
|
---|
197 | void
|
---|
198 | write(int value) throws IOException;
|
---|
199 |
|
---|
200 | /*************************************************************************/
|
---|
201 |
|
---|
202 | /**
|
---|
203 | * This method writes the raw byte array passed in to the output stream.
|
---|
204 | *
|
---|
205 | * @param buf The byte array to write
|
---|
206 | *
|
---|
207 | * @exception IOException If an error occurs
|
---|
208 | */
|
---|
209 | void
|
---|
210 | write(byte[] buf) throws IOException;
|
---|
211 |
|
---|
212 | /*************************************************************************/
|
---|
213 |
|
---|
214 | /**
|
---|
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>.
|
---|
218 | *
|
---|
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
|
---|
222 | *
|
---|
223 | * @exception IOException If any other error occurs
|
---|
224 | */
|
---|
225 | void
|
---|
226 | write(byte[] buf, int offset, int len) throws IOException;
|
---|
227 |
|
---|
228 | } // interface DataOutput
|
---|