001 /* ImageOutputStream.java
002 Copyright (C) 2004, 2005 Free Software Foundation, Inc.
003
004 This file is part of GNU Classpath.
005
006 GNU Classpath is free software; you can redistribute it and/or modify
007 it under the terms of the GNU General Public License as published by
008 the Free Software Foundation; either version 2, or (at your option)
009 any later version.
010
011 GNU Classpath is distributed in the hope that it will be useful, but
012 WITHOUT ANY WARRANTY; without even the implied warranty of
013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014 General Public License for more details.
015
016 You should have received a copy of the GNU General Public License
017 along with GNU Classpath; see the file COPYING. If not, write to the
018 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
019 02110-1301 USA.
020
021 Linking this library statically or dynamically with other modules is
022 making a combined work based on this library. Thus, the terms and
023 conditions of the GNU General Public License cover the whole
024 combination.
025
026 As a special exception, the copyright holders of this library give you
027 permission to link this library with independent modules to produce an
028 executable, regardless of the license terms of these independent
029 modules, and to copy and distribute the resulting executable under
030 terms of your choice, provided that you also meet, for each linked
031 independent module, the terms and conditions of the license of that
032 module. An independent module is a module which is not derived from
033 or based on this library. If you modify this library, you may extend
034 this exception to your version of the library, but you are not
035 obligated to do so. If you do not wish to do so, delete this
036 exception statement from your version. */
037
038
039 package javax.imageio.stream;
040
041 import java.io.DataOutput;
042 import java.io.IOException;
043
044
045 /**
046 * An output stream for use by {@link javax.imageio.ImageWriter
047 * ImageWriters}.
048 *
049 * @since 1.4
050 *
051 * @author Sascha Brawer (brawer@dandelis.ch)
052 */
053 public interface ImageOutputStream
054 extends ImageInputStream, DataOutput
055 {
056 /**
057 * @param position
058 *
059 * @throws IOException if an errror occurs
060 */
061 void flushBefore(long position) throws IOException;
062
063 /**
064 * Writes an array into the stream.
065 *
066 * @param data the data to be written
067 *
068 * @throws IOException if an errror occurs
069 */
070 void write(byte[] data) throws IOException;
071
072 /**
073 * Writes a region of data from an array into the stream.
074 *
075 * @param data the data to be written
076 * @param offset the offset in the array
077 * @param len the length in the array
078 *
079 * @throws IOException if an errror occurs
080 */
081 void write(byte[] data, int offset, int len) throws IOException;
082
083 /**
084 * Writes an <code>int</code> into the stream.
085 *
086 * @param data the data to be written
087 *
088 * @throws IOException if an errror occurs
089 */
090 void write(int data) throws IOException;
091
092 /**
093 * Writes a bit value to the stream.
094 *
095 * @throws IOException if an error occurs
096 */
097 void writeBit(int bit) throws IOException;
098
099 /**
100 * Writes a number of bit values to the stream.
101 *
102 * @throws IOException if an errror occurs
103 */
104 void writeBits(long bits, int numBits) throws IOException;
105
106 /**
107 * Writes a <code>boolean</code> value into the stream.
108 *
109 * @param data the data to be written
110 *
111 * @throws IOException if an errror occurs
112 */
113 void writeBoolean(boolean data) throws IOException;
114
115 /**
116 * Writes a <code>byte</code> value into the stream.
117 *
118 * @param data the data to be written
119 *
120 * @throws IOException if an errror occurs
121 */
122 void writeByte(int data) throws IOException;
123
124 /**
125 * @param data the data to be written
126 *
127 * @throws IOException if an errror occurs
128 */
129 void writeBytes(String data) throws IOException;
130
131 /**
132 * Writes a character into the stream.
133 *
134 * @param data the data to be written
135 *
136 * @throws IOException if an errror occurs
137 */
138 void writeChar(int data) throws IOException;
139
140 /**
141 * Writes characters to the stream.
142 *
143 * @param data the data to be written
144 * @param offset the offset in the array
145 * @param len the lenth in the array
146 *
147 * @throws IOException if an errror occurs
148 */
149 void writeChars(char[] data, int offset, int len) throws IOException;
150
151 /**
152 * Writes characters from a given <code>String</code> into the stream.
153 *
154 * @param data the data to be written
155 *
156 * @throws IOException if an errror occurs
157 */
158 void writeChars(String data) throws IOException;
159
160 /**
161 * Writes a <code>double</code> into the stream.
162 *
163 * @param data the data to be written
164 *
165 * @throws IOException if an errror occurs
166 */
167 void writeDouble(double data) throws IOException;
168
169 /**
170 * Writes an array of <code>double</code> into the stream.
171 *
172 * @param data the data to be written
173 * @param offset the offset in the array
174 * @param len the lenth in the array
175 *
176 * @throws IOException if an errror occurs
177 */
178 void writeDoubles(double[] data, int offset, int len)
179 throws IOException;
180
181 /**
182 * Writes a <code>float</code> into the stream.
183 *
184 * @param data the data to be written
185 *
186 * @throws IOException if an errror occurs
187 */
188 void writeFloat(float data) throws IOException;
189
190 /**
191 * Writes an array of <code>float</code> into the stream.
192 *
193 * @param data the data to be written
194 * @param offset the offset in the array
195 * @param len the lenth in the array
196 *
197 * @throws IOException if an errror occurs
198 */
199 void writeFloats(float[] data, int offset, int len) throws IOException;
200
201 /**
202 * Writes a <code>int</code> into the stream.
203 *
204 * @param data the data to be written
205 *
206 * @throws IOException if an errror occurs
207 */
208 void writeInt(int data) throws IOException;
209
210 /**
211 * Writes an array of <code>int</code> into the stream.
212 *
213 * @param data the data to be written
214 * @param offset the offset in the array
215 * @param len the lenth in the array
216 *
217 * @throws IOException if an errror occurs
218 */
219 void writeInts(int[] data, int offset, int len) throws IOException;
220
221 /**
222 * Writes a <code>long</code> into the stream.
223 *
224 * @param data the data to be written
225 *
226 * @throws IOException if an errror occurs
227 */
228 void writeLong(long data) throws IOException;
229
230 /**
231 * Writes an array of <code>long</code> into the stream.
232 *
233 * @param data the data to be written
234 * @param offset the offset in the array
235 * @param len the lenth in the array
236 *
237 * @throws IOException if an errror occurs
238 */
239 void writeLongs(long[] data, int offset, int len) throws IOException;
240
241 /**
242 * Writes a <code>short</code> into the stream.
243 *
244 * @param data the data to be written
245 *
246 * @throws IOException if an errror occurs
247 */
248 void writeShort(int data) throws IOException;
249
250 /**
251 * Writes an array of <code>short</code> into the stream.
252 *
253 * @param data the data to be written
254 * @param offset the offset in the array
255 * @param len the lenth in the array
256 *
257 * @throws IOException if an errror occurs
258 */
259 void writeShorts(short[] data, int offset, int len) throws IOException;
260
261 /**
262 * Writes a <code>String</code> into the stream.
263 *
264 * @param data the data to be written
265 *
266 * @throws IOException if an errror occurs
267 */
268 void writeUTF(String data) throws IOException;
269 }