summaryrefslogtreecommitdiffstats
path: root/awt/javax/imageio/stream/ImageOutputStream.java
blob: 28ec93277a44e0f4393f7f5c40e3e6d13fe242cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
/*
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in compliance with
 *  the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
/**
 * @author Rustem V. Rafikov
 * @version $Revision: 1.2 $
 */

package javax.imageio.stream;

import java.io.DataOutput;
import java.io.IOException;

/**
 * The ImageOutputStream represents output stream interface that is used by
 * ImageWriters.
 * 
 * @since Android 1.0
 */
public interface ImageOutputStream extends DataOutput, ImageInputStream {

    /**
     * Writes a single byte to the stream at the current position.
     * 
     * @param b
     *            the integer value, of which the 8 lowest bits will be written.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void write(int b) throws IOException;

    /**
     * Writes the bytes array to the stream.
     * 
     * @param b
     *            the byte array to be written.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void write(byte[] b) throws IOException;

    /**
     * Writes a number of bytes from the specified byte array beginning from the
     * specified offset.
     * 
     * @param b
     *            the byte array.
     * @param off
     *            the offset.
     * @param len
     *            the number of bytes to be written.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void write(byte[] b, int off, int len) throws IOException;

    /**
     * Writes the specified boolean value to the stream, 1 if it is true, 0 if
     * it is false.
     * 
     * @param b
     *            the boolean value to be written.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void writeBoolean(boolean b) throws IOException;

    /**
     * Writes the 8 lowest bits of the specified integer value to the stream.
     * 
     * @param b
     *            the specified integer value.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void writeByte(int b) throws IOException;

    /**
     * Writes a short value to the output stream.
     * 
     * @param v
     *            the short value to be written.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void writeShort(int v) throws IOException;

    /**
     * Writes the 16 lowest bits of the specified integer value to the stream.
     * 
     * @param v
     *            the specified integer value.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void writeChar(int v) throws IOException;

    /**
     * Writes an integer value to the output stream.
     * 
     * @param v
     *            the integer value to be written.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void writeInt(int v) throws IOException;

    /**
     * Write long.
     * 
     * @param v
     *            the long value.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void writeLong(long v) throws IOException;

    /**
     * Writes a float value to the output stream.
     * 
     * @param v
     *            the float which contains value to be written.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void writeFloat(float v) throws IOException;

    /**
     * Writes a double value to the output stream.
     * 
     * @param v
     *            the double which contains value to be written.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void writeDouble(double v) throws IOException;

    /**
     * Writes the specified string to the stream.
     * 
     * @param s
     *            the string to be written.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void writeBytes(String s) throws IOException;

    /**
     * Writes the specified String to the output stream.
     * 
     * @param s
     *            the String to be written.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void writeChars(String s) throws IOException;

    /**
     * Writes 2 bytes to the output stream in the modified UTF-8 representation
     * of every character of the specified string.
     * 
     * @param s
     *            the specified string to be written.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void writeUTF(String s) throws IOException;

    /**
     * Flushes the initial position in this stream prior to the specified stream
     * position.
     * 
     * @param pos
     *            the position.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void flushBefore(long pos) throws IOException;

    /**
     * Writes a len number of short values from the specified array to the
     * stream.
     * 
     * @param s
     *            the shorts array to be written.
     * @param off
     *            the offset in the char array.
     * @param len
     *            the length of chars to be written.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void writeShorts(short[] s, int off, int len) throws IOException;

    /**
     * Writes a len number of chars to the stream.
     * 
     * @param c
     *            the char array to be written.
     * @param off
     *            the offset in the char array.
     * @param len
     *            the length of chars to be written.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void writeChars(char[] c, int off, int len) throws IOException;

    /**
     * Writes a len number of integer values from the specified array to the
     * stream.
     * 
     * @param i
     *            the integer array to be written.
     * @param off
     *            the offset in the char array.
     * @param len
     *            the length of chars to be written.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void writeInts(int[] i, int off, int len) throws IOException;

    /**
     * Writes a len number of long values from the specified array to the
     * stream.
     * 
     * @param l
     *            the long array to be written.
     * @param off
     *            the offset in the char array.
     * @param len
     *            the length of chars to be written.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void writeLongs(long[] l, int off, int len) throws IOException;

    /**
     * Writes a len number of float values from the specified array to the
     * stream.
     * 
     * @param f
     *            the float array to be written.
     * @param off
     *            the offset in the char array.
     * @param len
     *            the length of chars to be written.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void writeFloats(float[] f, int off, int len) throws IOException;

    /**
     * Writes a len number of double values from the specified array to the
     * stream.
     * 
     * @param d
     *            the double array to be written.
     * @param off
     *            the offset in the char array.
     * @param len
     *            the length of chars to be written.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void writeDoubles(double[] d, int off, int len) throws IOException;

    /**
     * Writes a single bit at the current position.
     * 
     * @param bit
     *            the integer whose least significant bit is to be written to
     *            the stream.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void writeBit(int bit) throws IOException;

    /**
     * Writes a sequence of bits beginning from the current position.
     * 
     * @param bits
     *            the long value containing the bits to be written, starting
     *            with the bit in position numBits - 1 down to the least
     *            significant bit.
     * @param numBits
     *            the number of significant bit, it can be between 0 and 64.
     * @throws IOException
     *             if an I/O exception has occurred.
     */
    void writeBits(long bits, int numBits) throws IOException;

}