blob: 28ec93277a44e0f4393f7f5c40e3e6d13fe242cc [file] [log] [blame]
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -07001/*
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 */
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -080021
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070022package javax.imageio.stream;
23
24import java.io.DataOutput;
25import java.io.IOException;
26
27/**
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -080028 * The ImageOutputStream represents output stream interface that is used by
29 * ImageWriters.
30 *
31 * @since Android 1.0
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070032 */
33public interface ImageOutputStream extends DataOutput, ImageInputStream {
34
35 /**
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -080036 * Writes a single byte to the stream at the current position.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070037 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -080038 * @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.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070042 */
43 void write(int b) throws IOException;
44
45 /**
46 * Writes the bytes array to the stream.
47 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -080048 * @param b
49 * the byte array to be written.
50 * @throws IOException
51 * if an I/O exception has occurred.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070052 */
53 void write(byte[] b) throws IOException;
54
55 /**
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -080056 * Writes a number of bytes from the specified byte array beginning from the
57 * specified offset.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070058 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -080059 * @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.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070067 */
68 void write(byte[] b, int off, int len) throws IOException;
69
70 /**
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -080071 * Writes the specified boolean value to the stream, 1 if it is true, 0 if
72 * it is false.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070073 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -080074 * @param b
75 * the boolean value to be written.
76 * @throws IOException
77 * if an I/O exception has occurred.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070078 */
79 void writeBoolean(boolean b) throws IOException;
80
81 /**
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -080082 * Writes the 8 lowest bits of the specified integer value to the stream.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070083 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -080084 * @param b
85 * the specified integer value.
86 * @throws IOException
87 * if an I/O exception has occurred.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070088 */
89 void writeByte(int b) throws IOException;
90
91 /**
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -080092 * Writes a short value to the output stream.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070093 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -080094 * @param v
95 * the short value to be written.
96 * @throws IOException
97 * if an I/O exception has occurred.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070098 */
99 void writeShort(int v) throws IOException;
100
101 /**
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800102 * Writes the 16 lowest bits of the specified integer value to the stream.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700103 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800104 * @param v
105 * the specified integer value.
106 * @throws IOException
107 * if an I/O exception has occurred.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700108 */
109 void writeChar(int v) throws IOException;
110
111 /**
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800112 * Writes an integer value to the output stream.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700113 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800114 * @param v
115 * the integer value to be written.
116 * @throws IOException
117 * if an I/O exception has occurred.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700118 */
119 void writeInt(int v) throws IOException;
120
121 /**
122 * Write long.
123 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800124 * @param v
125 * the long value.
126 * @throws IOException
127 * if an I/O exception has occurred.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700128 */
129 void writeLong(long v) throws IOException;
130
131 /**
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800132 * Writes a float value to the output stream.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700133 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800134 * @param v
135 * the float which contains value to be written.
136 * @throws IOException
137 * if an I/O exception has occurred.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700138 */
139 void writeFloat(float v) throws IOException;
140
141 /**
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800142 * Writes a double value to the output stream.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700143 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800144 * @param v
145 * the double which contains value to be written.
146 * @throws IOException
147 * if an I/O exception has occurred.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700148 */
149 void writeDouble(double v) throws IOException;
150
151 /**
152 * Writes the specified string to the stream.
153 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800154 * @param s
155 * the string to be written.
156 * @throws IOException
157 * if an I/O exception has occurred.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700158 */
159 void writeBytes(String s) throws IOException;
160
161 /**
162 * Writes the specified String to the output stream.
163 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800164 * @param s
165 * the String to be written.
166 * @throws IOException
167 * if an I/O exception has occurred.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700168 */
169 void writeChars(String s) throws IOException;
170
171 /**
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800172 * Writes 2 bytes to the output stream in the modified UTF-8 representation
173 * of every character of the specified string.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700174 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800175 * @param s
176 * the specified string to be written.
177 * @throws IOException
178 * if an I/O exception has occurred.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700179 */
180 void writeUTF(String s) throws IOException;
181
182 /**
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800183 * Flushes the initial position in this stream prior to the specified stream
184 * position.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700185 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800186 * @param pos
187 * the position.
188 * @throws IOException
189 * if an I/O exception has occurred.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700190 */
191 void flushBefore(long pos) throws IOException;
192
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700193 /**
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800194 * Writes a len number of short values from the specified array to the
195 * stream.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700196 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800197 * @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.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700205 */
206 void writeShorts(short[] s, int off, int len) throws IOException;
207
208 /**
209 * Writes a len number of chars to the stream.
210 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800211 * @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.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700219 */
220 void writeChars(char[] c, int off, int len) throws IOException;
221
222 /**
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800223 * Writes a len number of integer values from the specified array to the
224 * stream.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700225 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800226 * @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.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700234 */
235 void writeInts(int[] i, int off, int len) throws IOException;
236
237 /**
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800238 * Writes a len number of long values from the specified array to the
239 * stream.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700240 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800241 * @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.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700249 */
250 void writeLongs(long[] l, int off, int len) throws IOException;
251
252 /**
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800253 * Writes a len number of float values from the specified array to the
254 * stream.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700255 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800256 * @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.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700264 */
265 void writeFloats(float[] f, int off, int len) throws IOException;
266
267 /**
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800268 * Writes a len number of double values from the specified array to the
269 * stream.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700270 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800271 * @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.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700279 */
280 void writeDoubles(double[] d, int off, int len) throws IOException;
281
282 /**
283 * Writes a single bit at the current position.
284 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800285 * @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.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700290 */
291 void writeBit(int bit) throws IOException;
292
293 /**
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800294 * Writes a sequence of bits beginning from the current position.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700295 *
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -0800296 * @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.
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -0700304 */
305 void writeBits(long bits, int numBits) throws IOException;
306
307}