author | phh |
Sat, 30 Nov 2019 14:33:05 -0800 | |
changeset 59330 | 5b96c12f909d |
parent 59201 | b24f4caa1411 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package java.io; |
|
27 |
||
28 |
/** |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
29 |
* The {@code DataOutput} interface provides |
2 | 30 |
* for converting data from any of the Java |
31 |
* primitive types to a series of bytes and |
|
32 |
* writing these bytes to a binary stream. |
|
33 |
* There is also a facility for converting |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
34 |
* a {@code String} into |
2 | 35 |
* <a href="DataInput.html#modified-utf-8">modified UTF-8</a> |
36 |
* format and writing the resulting series |
|
37 |
* of bytes. |
|
38 |
* <p> |
|
39 |
* For all the methods in this interface that |
|
40 |
* write bytes, it is generally true that if |
|
41 |
* a byte cannot be written for any reason, |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
42 |
* an {@code IOException} is thrown. |
2 | 43 |
* |
44 |
* @author Frank Yellin |
|
45 |
* @see java.io.DataInput |
|
46 |
* @see java.io.DataOutputStream |
|
24865
09b1d992ca72
8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents:
23010
diff
changeset
|
47 |
* @since 1.0 |
2 | 48 |
*/ |
59201
b24f4caa1411
8234335: Remove line break in class declaration in java.base
jboes
parents:
58288
diff
changeset
|
49 |
public interface DataOutput { |
2 | 50 |
/** |
51 |
* Writes to the output stream the eight |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
52 |
* low-order bits of the argument {@code b}. |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
53 |
* The 24 high-order bits of {@code b} |
2 | 54 |
* are ignored. |
55 |
* |
|
56 |
* @param b the byte to be written. |
|
57 |
* @throws IOException if an I/O error occurs. |
|
58 |
*/ |
|
59 |
void write(int b) throws IOException; |
|
60 |
||
61 |
/** |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
62 |
* Writes to the output stream all the bytes in array {@code b}. |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
63 |
* If {@code b} is {@code null}, |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
64 |
* a {@code NullPointerException} is thrown. |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
65 |
* If {@code b.length} is zero, then |
2 | 66 |
* no bytes are written. Otherwise, the byte |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
67 |
* {@code b[0]} is written first, then |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
68 |
* {@code b[1]}, and so on; the last byte |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
69 |
* written is {@code b[b.length-1]}. |
2 | 70 |
* |
71 |
* @param b the data. |
|
72 |
* @throws IOException if an I/O error occurs. |
|
73 |
*/ |
|
74 |
void write(byte b[]) throws IOException; |
|
75 |
||
76 |
/** |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
77 |
* Writes {@code len} bytes from array |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
78 |
* {@code b}, in order, to |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
79 |
* the output stream. If {@code b} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
80 |
* is {@code null}, a {@code NullPointerException} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
81 |
* is thrown. If {@code off} is negative, |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
82 |
* or {@code len} is negative, or {@code off+len} |
2 | 83 |
* is greater than the length of the array |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
84 |
* {@code b}, then an {@code IndexOutOfBoundsException} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
85 |
* is thrown. If {@code len} is zero, |
2 | 86 |
* then no bytes are written. Otherwise, the |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
87 |
* byte {@code b[off]} is written first, |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
88 |
* then {@code b[off+1]}, and so on; the |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
89 |
* last byte written is {@code b[off+len-1]}. |
2 | 90 |
* |
91 |
* @param b the data. |
|
92 |
* @param off the start offset in the data. |
|
93 |
* @param len the number of bytes to write. |
|
94 |
* @throws IOException if an I/O error occurs. |
|
95 |
*/ |
|
96 |
void write(byte b[], int off, int len) throws IOException; |
|
97 |
||
98 |
/** |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
99 |
* Writes a {@code boolean} value to this output stream. |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
100 |
* If the argument {@code v} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
101 |
* is {@code true}, the value {@code (byte)1} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
102 |
* is written; if {@code v} is {@code false}, |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
103 |
* the value {@code (byte)0} is written. |
2 | 104 |
* The byte written by this method may |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
105 |
* be read by the {@code readBoolean} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
106 |
* method of interface {@code DataInput}, |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
107 |
* which will then return a {@code boolean} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
108 |
* equal to {@code v}. |
2 | 109 |
* |
110 |
* @param v the boolean to be written. |
|
111 |
* @throws IOException if an I/O error occurs. |
|
112 |
*/ |
|
113 |
void writeBoolean(boolean v) throws IOException; |
|
114 |
||
115 |
/** |
|
116 |
* Writes to the output stream the eight low- |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
117 |
* order bits of the argument {@code v}. |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
118 |
* The 24 high-order bits of {@code v} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
119 |
* are ignored. (This means that {@code writeByte} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
120 |
* does exactly the same thing as {@code write} |
2 | 121 |
* for an integer argument.) The byte written |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
122 |
* by this method may be read by the {@code readByte} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
123 |
* method of interface {@code DataInput}, |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
124 |
* which will then return a {@code byte} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
125 |
* equal to {@code (byte)v}. |
2 | 126 |
* |
127 |
* @param v the byte value to be written. |
|
128 |
* @throws IOException if an I/O error occurs. |
|
129 |
*/ |
|
130 |
void writeByte(int v) throws IOException; |
|
131 |
||
132 |
/** |
|
133 |
* Writes two bytes to the output |
|
134 |
* stream to represent the value of the argument. |
|
135 |
* The byte values to be written, in the order |
|
21334 | 136 |
* shown, are: |
137 |
* <pre>{@code |
|
138 |
* (byte)(0xff & (v >> 8)) |
|
139 |
* (byte)(0xff & v) |
|
140 |
* }</pre> <p> |
|
2 | 141 |
* The bytes written by this method may be |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
142 |
* read by the {@code readShort} method |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
143 |
* of interface {@code DataInput} , which |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
144 |
* will then return a {@code short} equal |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
145 |
* to {@code (short)v}. |
2 | 146 |
* |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
147 |
* @param v the {@code short} value to be written. |
2 | 148 |
* @throws IOException if an I/O error occurs. |
149 |
*/ |
|
150 |
void writeShort(int v) throws IOException; |
|
151 |
||
152 |
/** |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
153 |
* Writes a {@code char} value, which |
2 | 154 |
* is comprised of two bytes, to the |
155 |
* output stream. |
|
156 |
* The byte values to be written, in the order |
|
157 |
* shown, are: |
|
21334 | 158 |
* <pre>{@code |
159 |
* (byte)(0xff & (v >> 8)) |
|
160 |
* (byte)(0xff & v) |
|
161 |
* }</pre><p> |
|
2 | 162 |
* The bytes written by this method may be |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
163 |
* read by the {@code readChar} method |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
164 |
* of interface {@code DataInput} , which |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
165 |
* will then return a {@code char} equal |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
166 |
* to {@code (char)v}. |
2 | 167 |
* |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
168 |
* @param v the {@code char} value to be written. |
2 | 169 |
* @throws IOException if an I/O error occurs. |
170 |
*/ |
|
171 |
void writeChar(int v) throws IOException; |
|
172 |
||
173 |
/** |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
174 |
* Writes an {@code int} value, which is |
2 | 175 |
* comprised of four bytes, to the output stream. |
176 |
* The byte values to be written, in the order |
|
177 |
* shown, are: |
|
21334 | 178 |
* <pre>{@code |
179 |
* (byte)(0xff & (v >> 24)) |
|
180 |
* (byte)(0xff & (v >> 16)) |
|
181 |
* (byte)(0xff & (v >> 8)) |
|
182 |
* (byte)(0xff & v) |
|
183 |
* }</pre><p> |
|
2 | 184 |
* The bytes written by this method may be read |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
185 |
* by the {@code readInt} method of interface |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
186 |
* {@code DataInput} , which will then |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
187 |
* return an {@code int} equal to {@code v}. |
2 | 188 |
* |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
189 |
* @param v the {@code int} value to be written. |
2 | 190 |
* @throws IOException if an I/O error occurs. |
191 |
*/ |
|
192 |
void writeInt(int v) throws IOException; |
|
193 |
||
194 |
/** |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
195 |
* Writes a {@code long} value, which is |
2 | 196 |
* comprised of eight bytes, to the output stream. |
197 |
* The byte values to be written, in the order |
|
198 |
* shown, are: |
|
21334 | 199 |
* <pre>{@code |
200 |
* (byte)(0xff & (v >> 56)) |
|
201 |
* (byte)(0xff & (v >> 48)) |
|
202 |
* (byte)(0xff & (v >> 40)) |
|
203 |
* (byte)(0xff & (v >> 32)) |
|
204 |
* (byte)(0xff & (v >> 24)) |
|
205 |
* (byte)(0xff & (v >> 16)) |
|
206 |
* (byte)(0xff & (v >> 8)) |
|
207 |
* (byte)(0xff & v) |
|
208 |
* }</pre><p> |
|
2 | 209 |
* The bytes written by this method may be |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
210 |
* read by the {@code readLong} method |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
211 |
* of interface {@code DataInput} , which |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
212 |
* will then return a {@code long} equal |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
213 |
* to {@code v}. |
2 | 214 |
* |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
215 |
* @param v the {@code long} value to be written. |
2 | 216 |
* @throws IOException if an I/O error occurs. |
217 |
*/ |
|
218 |
void writeLong(long v) throws IOException; |
|
219 |
||
220 |
/** |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
221 |
* Writes a {@code float} value, |
2 | 222 |
* which is comprised of four bytes, to the output stream. |
223 |
* It does this as if it first converts this |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
224 |
* {@code float} value to an {@code int} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
225 |
* in exactly the manner of the {@code Float.floatToIntBits} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
226 |
* method and then writes the {@code int} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
227 |
* value in exactly the manner of the {@code writeInt} |
2 | 228 |
* method. The bytes written by this method |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
229 |
* may be read by the {@code readFloat} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
230 |
* method of interface {@code DataInput}, |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
231 |
* which will then return a {@code float} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
232 |
* equal to {@code v}. |
2 | 233 |
* |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
234 |
* @param v the {@code float} value to be written. |
2 | 235 |
* @throws IOException if an I/O error occurs. |
236 |
*/ |
|
237 |
void writeFloat(float v) throws IOException; |
|
238 |
||
239 |
/** |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
240 |
* Writes a {@code double} value, |
2 | 241 |
* which is comprised of eight bytes, to the output stream. |
242 |
* It does this as if it first converts this |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
243 |
* {@code double} value to a {@code long} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
244 |
* in exactly the manner of the {@code Double.doubleToLongBits} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
245 |
* method and then writes the {@code long} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
246 |
* value in exactly the manner of the {@code writeLong} |
2 | 247 |
* method. The bytes written by this method |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
248 |
* may be read by the {@code readDouble} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
249 |
* method of interface {@code DataInput}, |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
250 |
* which will then return a {@code double} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
251 |
* equal to {@code v}. |
2 | 252 |
* |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
253 |
* @param v the {@code double} value to be written. |
2 | 254 |
* @throws IOException if an I/O error occurs. |
255 |
*/ |
|
256 |
void writeDouble(double v) throws IOException; |
|
257 |
||
258 |
/** |
|
259 |
* Writes a string to the output stream. |
|
260 |
* For every character in the string |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
261 |
* {@code s}, taken in order, one byte |
2 | 262 |
* is written to the output stream. If |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
263 |
* {@code s} is {@code null}, a {@code NullPointerException} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
264 |
* is thrown.<p> If {@code s.length} |
2 | 265 |
* is zero, then no bytes are written. Otherwise, |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
266 |
* the character {@code s[0]} is written |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
267 |
* first, then {@code s[1]}, and so on; |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
268 |
* the last character written is {@code s[s.length-1]}. |
2 | 269 |
* For each character, one byte is written, |
270 |
* the low-order byte, in exactly the manner |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
271 |
* of the {@code writeByte} method . The |
2 | 272 |
* high-order eight bits of each character |
273 |
* in the string are ignored. |
|
274 |
* |
|
275 |
* @param s the string of bytes to be written. |
|
276 |
* @throws IOException if an I/O error occurs. |
|
277 |
*/ |
|
278 |
void writeBytes(String s) throws IOException; |
|
279 |
||
280 |
/** |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
281 |
* Writes every character in the string {@code s}, |
2 | 282 |
* to the output stream, in order, |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
283 |
* two bytes per character. If {@code s} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
284 |
* is {@code null}, a {@code NullPointerException} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
285 |
* is thrown. If {@code s.length} |
2 | 286 |
* is zero, then no characters are written. |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
287 |
* Otherwise, the character {@code s[0]} |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
288 |
* is written first, then {@code s[1]}, |
2 | 289 |
* and so on; the last character written is |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
290 |
* {@code s[s.length-1]}. For each character, |
2 | 291 |
* two bytes are actually written, high-order |
292 |
* byte first, in exactly the manner of the |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
293 |
* {@code writeChar} method. |
2 | 294 |
* |
295 |
* @param s the string value to be written. |
|
296 |
* @throws IOException if an I/O error occurs. |
|
297 |
*/ |
|
298 |
void writeChars(String s) throws IOException; |
|
299 |
||
300 |
/** |
|
301 |
* Writes two bytes of length information |
|
302 |
* to the output stream, followed |
|
303 |
* by the |
|
304 |
* <a href="DataInput.html#modified-utf-8">modified UTF-8</a> |
|
305 |
* representation |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
306 |
* of every character in the string {@code s}. |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
307 |
* If {@code s} is {@code null}, |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
308 |
* a {@code NullPointerException} is thrown. |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
309 |
* Each character in the string {@code s} |
2 | 310 |
* is converted to a group of one, two, or |
311 |
* three bytes, depending on the value of the |
|
312 |
* character.<p> |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
313 |
* If a character {@code c} |
2 | 314 |
* is in the range <code>\u0001</code> through |
315 |
* <code>\u007f</code>, it is represented |
|
21334 | 316 |
* by one byte: |
2 | 317 |
* <pre>(byte)c </pre> <p> |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
318 |
* If a character {@code c} is <code>\u0000</code> |
2 | 319 |
* or is in the range <code>\u0080</code> |
320 |
* through <code>\u07ff</code>, then it is |
|
321 |
* represented by two bytes, to be written |
|
21334 | 322 |
* in the order shown: <pre>{@code |
323 |
* (byte)(0xc0 | (0x1f & (c >> 6))) |
|
324 |
* (byte)(0x80 | (0x3f & c)) |
|
325 |
* }</pre> <p> If a character |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
326 |
* {@code c} is in the range <code>\u0800</code> |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
327 |
* through {@code uffff}, then it is |
2 | 328 |
* represented by three bytes, to be written |
21334 | 329 |
* in the order shown: <pre>{@code |
330 |
* (byte)(0xe0 | (0x0f & (c >> 12))) |
|
331 |
* (byte)(0x80 | (0x3f & (c >> 6))) |
|
332 |
* (byte)(0x80 | (0x3f & c)) |
|
333 |
* }</pre> <p> First, |
|
2 | 334 |
* the total number of bytes needed to represent |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
335 |
* all the characters of {@code s} is |
2 | 336 |
* calculated. If this number is larger than |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
337 |
* {@code 65535}, then a {@code UTFDataFormatException} |
2 | 338 |
* is thrown. Otherwise, this length is written |
339 |
* to the output stream in exactly the manner |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
340 |
* of the {@code writeShort} method; |
2 | 341 |
* after this, the one-, two-, or three-byte |
342 |
* representation of each character in the |
|
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
343 |
* string {@code s} is written.<p> The |
2 | 344 |
* bytes written by this method may be read |
58288
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
345 |
* by the {@code readUTF} method of interface |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
346 |
* {@code DataInput} , which will then |
48e480e56aad
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents:
47216
diff
changeset
|
347 |
* return a {@code String} equal to {@code s}. |
2 | 348 |
* |
349 |
* @param s the string value to be written. |
|
350 |
* @throws IOException if an I/O error occurs. |
|
351 |
*/ |
|
352 |
void writeUTF(String s) throws IOException; |
|
353 |
} |