blob: e59b69da5234f30bb79305cb9a75e2619c052a1d [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 */
21package javax.imageio.stream;
22
23import java.io.DataOutput;
24import java.io.IOException;
25
26/**
27 * The ImageOutputStream represents output stream interface that is
28 * used by ImageWriters.
29 */
30public interface ImageOutputStream extends DataOutput, ImageInputStream {
31
32 /**
33 * Writes a single byte to the stream at the current position.
34 *
35 * @param b the int value, of which the 8 lowest bits
36 * will be written.
37 *
38 * @throws IOException Signals that an I/O exception has occurred.
39 */
40 void write(int b) throws IOException;
41
42 /**
43 * Writes the bytes array to the stream.
44 *
45 * @param b the byte array to be written.
46 *
47 * @throws IOException Signals that an I/O exception has occurred.
48 */
49 void write(byte[] b) throws IOException;
50
51 /**
52 * Writes a number of bytes from the specified byte array
53 * beggining from the specified offset.
54 *
55 * @param b the byte array.
56 * @param off the offset.
57 * @param len the number of bytes to be written.
58 *
59 * @throws IOException Signals that an I/O exception has occurred.
60 */
61 void write(byte[] b, int off, int len) throws IOException;
62
63 /**
64 * Writes the specified boolean value to the stream, 1 if it is true,
65 * 0 if it is false.
66 *
67 * @param b the boolean value to be written.
68 *
69 * @throws IOException Signals that an I/O exception has occurred.
70 */
71 void writeBoolean(boolean b) throws IOException;
72
73 /**
74 * Writes the 8 lowest bits of the specified int value to the stream.
75 *
76 * @param b the specified int value.
77 *
78 * @throws IOException Signals that an I/O exception has occurred.
79 */
80 void writeByte(int b) throws IOException;
81
82 /**
83 * Writes a short value to the output stream.
84 *
85 * @param v the short value to be written.
86 *
87 * @throws IOException Signals that an I/O exception has occurred.
88 */
89 void writeShort(int v) throws IOException;
90
91 /**
92 * Writes the 16 lowest bits of the specified int value to the stream.
93 *
94 * @param v the specified int value.
95 *
96 * @throws IOException Signals that an I/O exception has occurred.
97 */
98 void writeChar(int v) throws IOException;
99
100 /**
101 * Writes an integer value to the output stream.
102 *
103 * @param v the integer value to be written.
104 *
105 * @throws IOException Signals that an I/O exception has occurred.
106 */
107 void writeInt(int v) throws IOException;
108
109 /**
110 * Write long.
111 *
112 * @param v the long value
113 *
114 * @throws IOException Signals that an I/O exception has occurred.
115 */
116 void writeLong(long v) throws IOException;
117
118 /**
119 * Writes a float value to the output stream.
120 *
121 * @param v the float which contains value to be written.
122 *
123 * @throws IOException Signals that an I/O exception has occurred.
124 */
125 void writeFloat(float v) throws IOException;
126
127 /**
128 * Writes a double value to the output stream.
129 *
130 * @param v the double which contains value to be written.
131 *
132 * @throws IOException Signals that an I/O exception has occurred.
133 */
134 void writeDouble(double v) throws IOException;
135
136 /**
137 * Writes the specified string to the stream.
138 *
139 * @param s the string to be written.
140 *
141 * @throws IOException Signals that an I/O exception has occurred.
142 */
143 void writeBytes(String s) throws IOException;
144
145 /**
146 * Writes the specified String to the output stream.
147 *
148 * @param s the String to be written.
149 *
150 * @throws IOException Signals that an I/O exception has occurred.
151 */
152 void writeChars(String s) throws IOException;
153
154 /**
155 * Writes 2 bytes to the output stream in
156 * the modified UTF-8 representation of every character of
157 * the specified string.
158 *
159 * @param s the specified string to be written.
160 *
161 * @throws IOException Signals that an I/O exception has occurred.
162 */
163 void writeUTF(String s) throws IOException;
164
165 /**
166 * Flushes the initial position in this stream prior to the
167 * specified stream position.
168 *
169 * @param pos the position.
170 *
171 * @throws IOException Signals that an I/O exception has occurred.
172 */
173 void flushBefore(long pos) throws IOException;
174
175
176 /**
177 * Writes a len number of short values from the specified array
178 * to the stream.
179 *
180 * @param s the shorts array to be written.
181 * @param off the offset in the char array.
182 * @param len the length of chars to be written.
183 *
184 * @throws IOException Signals that an I/O exception has occurred.
185 */
186 void writeShorts(short[] s, int off, int len) throws IOException;
187
188 /**
189 * Writes a len number of chars to the stream.
190 *
191 * @param c the char array to be written.
192 * @param off the offset in the char array.
193 * @param len the length of chars to be written.
194 *
195 * @throws IOException Signals that an I/O exception has occurred.
196 */
197 void writeChars(char[] c, int off, int len) throws IOException;
198
199 /**
200 * Writes a len number of int values from the specified array
201 * to the stream.
202 *
203 * @param i the int array to be written.
204 * @param off the offset in the char array.
205 * @param len the length of chars to be written.
206 *
207 * @throws IOException Signals that an I/O exception has occurred.
208 */
209 void writeInts(int[] i, int off, int len) throws IOException;
210
211 /**
212 * Writes a len number of long values from the specified array
213 * to the stream.
214 *
215 * @param l the long array to be written.
216 * @param off the offset in the char array.
217 * @param len the length of chars to be written.
218 *
219 * @throws IOException Signals that an I/O exception has occurred.
220 */
221 void writeLongs(long[] l, int off, int len) throws IOException;
222
223 /**
224 * Writes a len number of float values from the specified array
225 * to the stream.
226 *
227 * @param f the float array to be written.
228 * @param off the offset in the char array.
229 * @param len the length of chars to be written.
230 *
231 * @throws IOException Signals that an I/O exception has occurred.
232 */
233 void writeFloats(float[] f, int off, int len) throws IOException;
234
235 /**
236 * Writes a len number of double values from the specified array
237 * to the stream.
238 *
239 * @param d the double array to be written.
240 * @param off the offset in the char array.
241 * @param len the length of chars to be written.
242 *
243 * @throws IOException Signals that an I/O exception has occurred.
244 */
245 void writeDoubles(double[] d, int off, int len) throws IOException;
246
247 /**
248 * Writes a single bit at the current position.
249 *
250 * @param bit the an int whose least significant bit is to be
251 * written to the stream.
252 *
253 * @throws IOException Signals that an I/O exception has occurred.
254 */
255 void writeBit(int bit) throws IOException;
256
257 /**
258 * Writes a sequence of bits beggining from the current position.
259 *
260 * @param bits a long value containing the bits to be written,
261 * starting with the bit in position numBits - 1 down to the
262 * least significant bit.
263 * @param numBits the number of significant bit ,
264 * it can be between 0 and 64.
265 *
266 * @throws IOException Signals that an I/O exception has occurred.
267 */
268 void writeBits(long bits, int numBits) throws IOException;
269
270}