blob: 28ec93277a44e0f4393f7f5c40e3e6d13fe242cc [file] [log] [blame]
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -08001/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17/**
18 * @author Rustem V. Rafikov
19 * @version $Revision: 1.2 $
20 */
21
22package javax.imageio.stream;
23
24import java.io.DataOutput;
25import java.io.IOException;
26
27/**
28 * The ImageOutputStream represents output stream interface that is used by
29 * ImageWriters.
30 *
31 * @since Android 1.0
32 */
33public interface ImageOutputStream extends DataOutput, ImageInputStream {
34
35 /**
36 * Writes a single byte to the stream at the current position.
37 *
38 * @param b
39 * the integer value, of which the 8 lowest bits will be written.
40 * @throws IOException
41 * if an I/O exception has occurred.
42 */
43 void write(int b) throws IOException;
44
45 /**
46 * Writes the bytes array to the stream.
47 *
48 * @param b
49 * the byte array to be written.
50 * @throws IOException
51 * if an I/O exception has occurred.
52 */
53 void write(byte[] b) throws IOException;
54
55 /**
56 * Writes a number of bytes from the specified byte array beginning from the
57 * specified offset.
58 *
59 * @param b
60 * the byte array.
61 * @param off
62 * the offset.
63 * @param len
64 * the number of bytes to be written.
65 * @throws IOException
66 * if an I/O exception has occurred.
67 */
68 void write(byte[] b, int off, int len) throws IOException;
69
70 /**
71 * Writes the specified boolean value to the stream, 1 if it is true, 0 if
72 * it is false.
73 *
74 * @param b
75 * the boolean value to be written.
76 * @throws IOException
77 * if an I/O exception has occurred.
78 */
79 void writeBoolean(boolean b) throws IOException;
80
81 /**
82 * Writes the 8 lowest bits of the specified integer value to the stream.
83 *
84 * @param b
85 * the specified integer value.
86 * @throws IOException
87 * if an I/O exception has occurred.
88 */
89 void writeByte(int b) throws IOException;
90
91 /**
92 * Writes a short value to the output stream.
93 *
94 * @param v
95 * the short value to be written.
96 * @throws IOException
97 * if an I/O exception has occurred.
98 */
99 void writeShort(int v) throws IOException;
100
101 /**
102 * Writes the 16 lowest bits of the specified integer value to the stream.
103 *
104 * @param v
105 * the specified integer value.
106 * @throws IOException
107 * if an I/O exception has occurred.
108 */
109 void writeChar(int v) throws IOException;
110
111 /**
112 * Writes an integer value to the output stream.
113 *
114 * @param v
115 * the integer value to be written.
116 * @throws IOException
117 * if an I/O exception has occurred.
118 */
119 void writeInt(int v) throws IOException;
120
121 /**
122 * Write long.
123 *
124 * @param v
125 * the long value.
126 * @throws IOException
127 * if an I/O exception has occurred.
128 */
129 void writeLong(long v) throws IOException;
130
131 /**
132 * Writes a float value to the output stream.
133 *
134 * @param v
135 * the float which contains value to be written.
136 * @throws IOException
137 * if an I/O exception has occurred.
138 */
139 void writeFloat(float v) throws IOException;
140
141 /**
142 * Writes a double value to the output stream.
143 *
144 * @param v
145 * the double which contains value to be written.
146 * @throws IOException
147 * if an I/O exception has occurred.
148 */
149 void writeDouble(double v) throws IOException;
150
151 /**
152 * Writes the specified string to the stream.
153 *
154 * @param s
155 * the string to be written.
156 * @throws IOException
157 * if an I/O exception has occurred.
158 */
159 void writeBytes(String s) throws IOException;
160
161 /**
162 * Writes the specified String to the output stream.
163 *
164 * @param s
165 * the String to be written.
166 * @throws IOException
167 * if an I/O exception has occurred.
168 */
169 void writeChars(String s) throws IOException;
170
171 /**
172 * Writes 2 bytes to the output stream in the modified UTF-8 representation
173 * of every character of the specified string.
174 *
175 * @param s
176 * the specified string to be written.
177 * @throws IOException
178 * if an I/O exception has occurred.
179 */
180 void writeUTF(String s) throws IOException;
181
182 /**
183 * Flushes the initial position in this stream prior to the specified stream
184 * position.
185 *
186 * @param pos
187 * the position.
188 * @throws IOException
189 * if an I/O exception has occurred.
190 */
191 void flushBefore(long pos) throws IOException;
192
193 /**
194 * Writes a len number of short values from the specified array to the
195 * stream.
196 *
197 * @param s
198 * the shorts array to be written.
199 * @param off
200 * the offset in the char array.
201 * @param len
202 * the length of chars to be written.
203 * @throws IOException
204 * if an I/O exception has occurred.
205 */
206 void writeShorts(short[] s, int off, int len) throws IOException;
207
208 /**
209 * Writes a len number of chars to the stream.
210 *
211 * @param c
212 * the char array to be written.
213 * @param off
214 * the offset in the char array.
215 * @param len
216 * the length of chars to be written.
217 * @throws IOException
218 * if an I/O exception has occurred.
219 */
220 void writeChars(char[] c, int off, int len) throws IOException;
221
222 /**
223 * Writes a len number of integer values from the specified array to the
224 * stream.
225 *
226 * @param i
227 * the integer array to be written.
228 * @param off
229 * the offset in the char array.
230 * @param len
231 * the length of chars to be written.
232 * @throws IOException
233 * if an I/O exception has occurred.
234 */
235 void writeInts(int[] i, int off, int len) throws IOException;
236
237 /**
238 * Writes a len number of long values from the specified array to the
239 * stream.
240 *
241 * @param l
242 * the long array to be written.
243 * @param off
244 * the offset in the char array.
245 * @param len
246 * the length of chars to be written.
247 * @throws IOException
248 * if an I/O exception has occurred.
249 */
250 void writeLongs(long[] l, int off, int len) throws IOException;
251
252 /**
253 * Writes a len number of float values from the specified array to the
254 * stream.
255 *
256 * @param f
257 * the float array to be written.
258 * @param off
259 * the offset in the char array.
260 * @param len
261 * the length of chars to be written.
262 * @throws IOException
263 * if an I/O exception has occurred.
264 */
265 void writeFloats(float[] f, int off, int len) throws IOException;
266
267 /**
268 * Writes a len number of double values from the specified array to the
269 * stream.
270 *
271 * @param d
272 * the double array to be written.
273 * @param off
274 * the offset in the char array.
275 * @param len
276 * the length of chars to be written.
277 * @throws IOException
278 * if an I/O exception has occurred.
279 */
280 void writeDoubles(double[] d, int off, int len) throws IOException;
281
282 /**
283 * Writes a single bit at the current position.
284 *
285 * @param bit
286 * the integer whose least significant bit is to be written to
287 * the stream.
288 * @throws IOException
289 * if an I/O exception has occurred.
290 */
291 void writeBit(int bit) throws IOException;
292
293 /**
294 * Writes a sequence of bits beginning from the current position.
295 *
296 * @param bits
297 * the long value containing the bits to be written, starting
298 * with the bit in position numBits - 1 down to the least
299 * significant bit.
300 * @param numBits
301 * the number of significant bit, it can be between 0 and 64.
302 * @throws IOException
303 * if an I/O exception has occurred.
304 */
305 void writeBits(long bits, int numBits) throws IOException;
306
307}