Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / libjava / classpath / javax / imageio / stream / ImageInputStream.java
bloba2af6c3e2a1802e55aa606b5f3be562f9856a40a
1 /* ImageInputStream.java
2 Copyright (C) 2004, 2005 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package javax.imageio.stream;
41 import java.io.DataInput;
42 import java.io.EOFException;
43 import java.io.IOException;
44 import java.nio.ByteOrder;
47 /**
48 * An input stream for use by {@link javax.imageio.ImageReader
49 * ImageReaders}.
51 * @since 1.4
53 * @author Sascha Brawer (brawer@dandelis.ch)
55 public interface ImageInputStream
56 extends DataInput
58 void setByteOrder(ByteOrder order);
60 ByteOrder getByteOrder();
62 int read()
63 throws IOException;
65 int read(byte[] b)
66 throws IOException;
68 int read(byte[] b, int offset, int length)
69 throws IOException;
72 /**
73 * Reads up to a specified number of bytes, and modifies a
74 * {@link IIOByteBuffer} to hold the read data.
76 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
77 * before any data is read.
79 * @param buf an <code>IIOByteBuffer</code> that will hold the read
80 * data.
82 * @param numBytes the maximum number of bytes to read.
84 * @throws IndexOutOfBoundsException if <code>numBytes</code> is
85 * negative.
87 * @throws NullPointerException if <code>buf</code> is
88 * <code>null</code>.
90 * @throws IOException if some general problem happens with
91 * accessing data.
93 void readBytes(IIOByteBuffer buf, int numBytes)
94 throws IOException;
97 /**
98 * Reads a byte and checks whether or not its value is zero.
100 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
101 * before the byte is read.
103 * @throws EOFException if the input stream is at its end.
105 * @throws IOException if some general problem happens with
106 * accessing data.
108 * @see #readBit()
109 * @see #readByte()
110 * @see #readFully(byte[], int, int)
112 boolean readBoolean()
113 throws IOException;
117 * Reads a signed byte.
119 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
120 * before any data is read.
122 * @throws EOFException if the input stream is at its end.
124 * @throws IOException if some general problem happens with
125 * accessing data.
127 * @see #readUnsignedByte()
128 * @see #readFully(byte[], int, int)
130 byte readByte()
131 throws IOException;
135 * Reads an unsigned byte.
137 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
138 * before any data is read.
140 * @throws EOFException if the input stream is at its end.
142 * @throws IOException if some general problem happens with
143 * accessing data.
145 * @see #readByte()
146 * @see #readFully(byte[], int, int)
148 int readUnsignedByte()
149 throws IOException;
153 * Reads an signed 16-bit integer. If necessary, the value gets
154 * converted from the stream&#x2019;s {@linkplain #getByteOrder()
155 * current byte order}.
157 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
158 * before any data is read.
160 * @throws EOFException if the input stream ends before all two
161 * bytes were read.
163 * @throws IOException if some general problem happens with
164 * accessing data.
166 * @see #readUnsignedShort()
167 * @see #readChar()
168 * @see #readFully(short[], int, int)
170 short readShort()
171 throws IOException;
175 * Reads an unsigned 16-bit integer. If necessary, the value gets
176 * converted from the stream&#x2019;s {@linkplain #getByteOrder()
177 * current byte order}.
179 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
180 * before any data is read.
182 * <p>This method does the same as {@link #readChar()}.
184 * @throws EOFException if the input stream ends before all two
185 * bytes were read.
187 * @throws IOException if some general problem happens with
188 * accessing data.
190 * @see #readShort()
191 * @see #readChar()
192 * @see #readFully(char[], int, int)
194 int readUnsignedShort()
195 throws IOException;
199 * Reads an unsigned 16-bit integer. If necessary, the value gets
200 * converted from the stream&#x2019;s {@linkplain #getByteOrder()
201 * current byte order}.
203 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
204 * before any data is read.
206 * <p>This method does the same as {@link #readUnsignedShort()}.
208 * @throws EOFException if the input stream ends before all two
209 * bytes were read.
211 * @throws IOException if some general problem happens with
212 * accessing data.
214 * @see #readFully(char[], int, int)
216 char readChar()
217 throws IOException;
221 * Reads a signed 32-bit integer. If necessary, the value gets
222 * converted from the stream&#x2019;s {@linkplain #getByteOrder()
223 * current byte order}.
225 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
226 * before any data is read.
228 * @throws EOFException if the input stream ends before all four
229 * bytes were read.
231 * @throws IOException if some general problem happens with
232 * accessing data.
234 * @see #readUnsignedInt()
235 * @see #readFully(int[], int, int)
237 int readInt()
238 throws IOException;
242 * Reads an unsigned 32-bit integer. If necessary, the value gets
243 * converted from the stream&#x2019;s {@linkplain #getByteOrder()
244 * current byte order}.
246 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
247 * before any data is read.
249 * @throws EOFException if the input stream ends before all four
250 * bytes were read.
252 * @throws IOException if some general problem happens with
253 * accessing data.
255 * @see #readInt()
256 * @see #readFully(int[], int, int)
258 long readUnsignedInt()
259 throws IOException;
263 * Reads a signed 64-bit integer. If necessary, the value gets
264 * converted from the stream&#x2019;s {@linkplain #getByteOrder()
265 * current byte order}.
267 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
268 * before any data is read.
270 * @throws EOFException if the input stream ends before all eight
271 * bytes were read.
273 * @throws IOException if some general problem happens with
274 * accessing data.
276 * @see #readFully(long[], int, int)
278 long readLong()
279 throws IOException;
283 * Reads an IEEE 32-bit single-precision floating point number. If
284 * necessary, the value gets converted from the stream&#x2019;s
285 * {@linkplain #getByteOrder() current byte order}.
287 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
288 * before any data is read.
290 * @throws EOFException if the input stream ends before all four
291 * bytes were read.
293 * @throws IOException if some general problem happens with
294 * accessing data.
296 * @see #readFully(float[], int, int)
298 float readFloat()
299 throws IOException;
303 * Reads an IEEE 64-bit double-precision floating point number. If
304 * necessary, the value gets converted from the stream&#x2019;s
305 * {@linkplain #getByteOrder() current byte order}.
307 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
308 * before any data is read.
310 * @throws EOFException if the input stream ends before all eight
311 * bytes were read.
313 * @throws IOException if some general problem happens with
314 * accessing data.
316 * @see #readFully(double[], int, int)
318 double readDouble()
319 throws IOException;
321 String readLine()
322 throws IOException;
324 String readUTF()
325 throws IOException;
329 * Reads a sequence of signed 8-bit integers into a
330 * <code>byte[]</code> array.
332 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
333 * before any data is read.
335 * @param b an array for storing the read values.
337 * @param offset the index of the first element in <code>b</code>
338 * that will hold read data.
340 * @param numBytes the number of bytes to read.
342 * @throws IndexOutOfBoundsException if <code>offset</code> or
343 * <code>numBytes</code> is negative, or if <code>offset +
344 * numBytes</code> exceeds <code>b.length</code>.
346 * @throws NullPointerException if <code>b</code> is
347 * <code>null</code>.
349 * @throws EOFException if the input stream ends before all content
350 * was read.
352 * @throws IOException if some general problem happens with
353 * accessing data.
355 * @see #readByte()
357 void readFully(byte[] b, int offset, int numBytes)
358 throws IOException;
362 * Reads a sequence of signed 8-bit integers into a
363 * <code>byte[]</code> array.
365 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
366 * before any data is read.
368 * @param b an array for storing the read values.
370 * @throws NullPointerException if <code>b</code> is
371 * <code>null</code>.
373 * @throws EOFException if the input stream ends before all content
374 * was read.
376 * @throws IOException if some general problem happens with
377 * accessing data.
379 * @see #readByte()
380 * @see #readFully(byte[], int, int)
382 void readFully(byte[] b)
383 throws IOException;
387 * Reads a sequence of signed 16-bit integers into a
388 * <code>short[]</code> array. If necessary, values are converted
389 * from the stream&#x2019;s {@linkplain #getByteOrder() current byte
390 * order}.
392 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
393 * before any data is read.
395 * @param s an array for storing the read values.
397 * @param offset the index of the first element in <code>s</code>
398 * that will hold read data.
400 * @param numShorts the number of signed 16-bit integers to read
401 * (which is one half of the number of bytes).
403 * @throws IndexOutOfBoundsException if <code>offset</code> or
404 * <code>numShorts</code> is negative, or if <code>offset +
405 * numShorts</code> exceeds <code>s.length</code>.
407 * @throws NullPointerException if <code>s</code> is
408 * <code>null</code>.
410 * @throws EOFException if the input stream ends before all content
411 * was read.
413 * @throws IOException if some general problem happens with
414 * accessing data.
416 * @see #readShort()
418 void readFully(short[] s, int offset, int numShorts)
419 throws IOException;
423 * Reads a sequence of unsigned 16-bit integers into a
424 * <code>char[]</code> array. If necessary, values are converted
425 * from the stream&#x2019;s {@linkplain #getByteOrder() current byte
426 * order}.
428 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
429 * before any data is read.
431 * @param c an array for storing the read values.
433 * @param offset the index of the first element in <code>c</code>
434 * that will hold read data.
436 * @param numChars the number of unsigned 16-bit integers to read
437 * (which is one half of the number of bytes).
439 * @throws IndexOutOfBoundsException if <code>offset</code> or
440 * <code>numChars</code> is negative, or if <code>offset +
441 * numChars</code> exceeds <code>c.length</code>.
443 * @throws NullPointerException if <code>c</code> is
444 * <code>null</code>.
446 * @throws EOFException if the input stream ends before all content
447 * was read.
449 * @throws IOException if some general problem happens with
450 * accessing data.
452 * @see #readChar()
454 void readFully(char[] c, int offset, int numChars)
455 throws IOException;
459 * Reads a sequence of signed 32-bit integers into a
460 * <code>long[]</code> array. If necessary, values are converted
461 * from the stream&#x2019;s {@linkplain #getByteOrder() current byte
462 * order}.
464 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
465 * before any data is read.
467 * @param i an array for storing the read values.
469 * @param offset the index of the first element in <code>i</code>
470 * that will hold read data.
472 * @param numLongs the number of signed 32-bit integers to read
473 * (which is one fourth of the number of bytes).
475 * @throws IndexOutOfBoundsException if <code>offset</code> or
476 * <code>numInts</code> is negative, or if <code>offset +
477 * numInts</code> exceeds <code>i.length</code>.
479 * @throws NullPointerException if <code>i</code> is
480 * <code>null</code>.
482 * @throws EOFException if the input stream ends before all content
483 * was read.
485 * @throws IOException if some general problem happens with
486 * accessing data.
488 * @see #readInt()
490 void readFully(int[] i, int offset, int numInts)
491 throws IOException;
495 * Reads a sequence of signed 64-bit integers into a
496 * <code>long[]</code> array. If necessary, values are converted
497 * from the stream&#x2019;s {@linkplain #getByteOrder() current byte
498 * order}.
500 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
501 * before any data is read.
503 * @param l an array for storing the read values.
505 * @param offset the index of the first element in <code>l</code>
506 * that will hold read data.
508 * @param numLongs the number of signed 64-bit integers to read
509 * (which is one eight of the number of bytes).
511 * @throws IndexOutOfBoundsException if <code>offset</code> or
512 * <code>numLongs</code> is negative, or if <code>offset +
513 * numLongs</code> exceeds <code>l.length</code>.
515 * @throws NullPointerException if <code>l</code> is
516 * <code>null</code>.
518 * @throws EOFException if the input stream ends before all content
519 * was read.
521 * @throws IOException if some general problem happens with
522 * accessing data.
524 * @see #readLong()
526 void readFully(long[] l, int offset, int numLongs)
527 throws IOException;
531 * Reads a sequence of IEEE 32-bit single-precision floating point
532 * numbers into a <code>float[]</code> array. If necessary, values
533 * are converted from the stream&#x2019;s {@linkplain
534 * #getByteOrder() current byte order}.
536 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
537 * before any data is read.
539 * @param d an array for storing the read values.
541 * @param offset the index of the first element in <code>d</code>
542 * that will hold read data.
544 * @param numFloats the number of IEEE 32-bit single-precision
545 * floating point numbers to read (which is one fourth of the number
546 * of bytes).
548 * @throws IndexOutOfBoundsException if <code>offset</code> or
549 * <code>numFloats</code> is negative, or if <code>offset +
550 * numFloats</code> exceeds <code>f.length</code>.
552 * @throws NullPointerException if <code>f</code> is
553 * <code>null</code>.
555 * @throws EOFException if the input stream ends before all content
556 * was read.
558 * @throws IOException if some general problem happens with
559 * accessing data.
561 * @see #readFloat()
563 void readFully(float[] f, int offset, int numFloats)
564 throws IOException;
568 * Reads a sequence of IEEE 64-bit double-precision floating point
569 * numbers into a <code>double[]</code> array. If necessary, values
570 * are converted from the stream&#x2019;s {@linkplain
571 * #getByteOrder() current byte order}.
573 * <p>The {@linkplain #getBitOffset() bit offset} is set to zero
574 * before any data is read.
576 * @param d an array for storing the read values.
578 * @param offset the index of the first element in <code>d</code>
579 * that will hold read data.
581 * @param numDoubles the number of IEEE 64-bit double-precision
582 * floating point numbers to read (which is one eight of the number
583 * of bytes).
585 * @throws IndexOutOfBoundsException if <code>offset</code> or
586 * <code>numDoubles</code> is negative, or if <code>offset +
587 * numDoubles</code> exceeds <code>d.length</code>.
589 * @throws NullPointerException if <code>d</code> is
590 * <code>null</code>.
592 * @throws EOFException if the input stream ends before all content
593 * was read.
595 * @throws IOException if some general problem happens with
596 * accessing data.
598 * @see #readDouble()
600 void readFully(double[] d, int offset, int numDoubles)
601 throws IOException;
603 long getStreamPosition()
604 throws IOException;
606 int getBitOffset()
607 throws IOException;
609 void setBitOffset(int bitOffset)
610 throws IOException;
612 int readBit()
613 throws IOException;
615 long readBits(int numBits)
616 throws IOException;
618 long length()
619 throws IOException;
621 int skipBytes(int numBytes)
622 throws IOException;
624 long skipBytes(long numBytes)
625 throws IOException;
627 void seek(long pos)
628 throws IOException;
630 void mark();
632 void reset()
633 throws IOException;
635 void flushBefore(long pos)
636 throws IOException;
638 void flush()
639 throws IOException;
641 long getFlushedPosition();
643 boolean isCached();
645 boolean isCachedMemory();
647 boolean isCachedFile();
649 void close()
650 throws IOException;