jdk/src/share/classes/javax/imageio/stream/ImageInputStream.java

Print this page
rev 2483 : 6911258: Project Coin: Add essential API support for Automatic Resource Management (ARM) blocks
6911261: Project Coin: Retrofit Automatic Resource Management (ARM) support onto platform APIs
6962571: Infinite loop in printing out Throwable stack traces with circular references
Reviewed-by: darcy, alanb
Contributed-by: jjb@google.com


   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javax.imageio.stream;
  27 

  28 import java.io.DataInput;
  29 import java.io.IOException;
  30 import java.nio.ByteOrder;
  31 
  32 /**
  33  * A seekable input stream interface for use by
  34  * <code>ImageReader</code>s.  Various input sources, such as
  35  * <code>InputStream</code>s and <code>File</code>s,
  36  * as well as future fast I/O sources may be "wrapped" by a suitable
  37  * implementation of this interface for use by the Image I/O API.
  38  *
  39  * @see ImageInputStreamImpl
  40  * @see FileImageInputStream
  41  * @see FileCacheImageInputStream
  42  * @see MemoryCacheImageInputStream
  43  *
  44  */
  45 public interface ImageInputStream extends DataInput {
  46 
  47     /**
  48      * Sets the desired byte order for future reads of data values
  49      * from this stream.  For example, the sequence of bytes '0x01
  50      * 0x02 0x03 0x04' if read as a 4-byte integer would have the
  51      * value '0x01020304' using network byte order and the value
  52      * '0x04030201' under the reverse byte order.
  53      *
  54      * <p> The enumeration class <code>java.nio.ByteOrder</code> is
  55      * used to specify the byte order.  A value of
  56      * <code>ByteOrder.BIG_ENDIAN</code> specifies so-called
  57      * big-endian or network byte order, in which the high-order byte
  58      * comes first.  Motorola and Sparc processors store data in this
  59      * format, while Intel processors store data in the reverse
  60      * <code>ByteOrder.LITTLE_ENDIAN</code> order.
  61      *
  62      * <p> The byte order has no effect on the results returned from
  63      * the <code>readBits</code> method (or the value written by
  64      * <code>ImageOutputStream.writeBits</code>).
  65      *




   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javax.imageio.stream;
  27 
  28 import java.io.Closeable;
  29 import java.io.DataInput;
  30 import java.io.IOException;
  31 import java.nio.ByteOrder;
  32 
  33 /**
  34  * A seekable input stream interface for use by
  35  * <code>ImageReader</code>s.  Various input sources, such as
  36  * <code>InputStream</code>s and <code>File</code>s,
  37  * as well as future fast I/O sources may be "wrapped" by a suitable
  38  * implementation of this interface for use by the Image I/O API.
  39  *
  40  * @see ImageInputStreamImpl
  41  * @see FileImageInputStream
  42  * @see FileCacheImageInputStream
  43  * @see MemoryCacheImageInputStream
  44  *
  45  */
  46 public interface ImageInputStream extends DataInput, Closeable {
  47 
  48     /**
  49      * Sets the desired byte order for future reads of data values
  50      * from this stream.  For example, the sequence of bytes '0x01
  51      * 0x02 0x03 0x04' if read as a 4-byte integer would have the
  52      * value '0x01020304' using network byte order and the value
  53      * '0x04030201' under the reverse byte order.
  54      *
  55      * <p> The enumeration class <code>java.nio.ByteOrder</code> is
  56      * used to specify the byte order.  A value of
  57      * <code>ByteOrder.BIG_ENDIAN</code> specifies so-called
  58      * big-endian or network byte order, in which the high-order byte
  59      * comes first.  Motorola and Sparc processors store data in this
  60      * format, while Intel processors store data in the reverse
  61      * <code>ByteOrder.LITTLE_ENDIAN</code> order.
  62      *
  63      * <p> The byte order has no effect on the results returned from
  64      * the <code>readBits</code> method (or the value written by
  65      * <code>ImageOutputStream.writeBits</code>).
  66      *