0N/A/*
2362N/A * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.imageio.stream;
0N/A
0N/Aimport java.io.DataOutput;
0N/Aimport java.io.IOException;
0N/A
0N/A/**
0N/A * A seekable output stream interface for use by
0N/A * <code>ImageWriter</code>s. Various output destinations, such as
0N/A * <code>OutputStream</code>s and <code>File</code>s, as well as
0N/A * future fast I/O destinations may be "wrapped" by a suitable
0N/A * implementation of this interface for use by the Image I/O API.
0N/A *
0N/A * <p> Unlike a standard <code>OutputStream</code>, ImageOutputStream
0N/A * extends its counterpart, <code>ImageInputStream</code>. Thus it is
0N/A * possible to read from the stream as it is being written. The same
0N/A * seek and flush positions apply to both reading and writing, although
0N/A * the semantics for dealing with a non-zero bit offset before a byte-aligned
0N/A * write are necessarily different from the semantics for dealing with
0N/A * a non-zero bit offset before a byte-aligned read. When reading bytes,
0N/A * any bit offset is set to 0 before the read; when writing bytes, a
0N/A * non-zero bit offset causes the remaining bits in the byte to be written
0N/A * as 0s. The byte-aligned write then starts at the next byte position.
0N/A *
0N/A * @see ImageInputStream
0N/A *
0N/A */
0N/Apublic interface ImageOutputStream extends ImageInputStream, DataOutput {
0N/A
0N/A /**
0N/A * Writes a single byte to the stream at the current position.
0N/A * The 24 high-order bits of <code>b</code> are ignored.
0N/A *
0N/A * <p> If the bit offset within the stream is non-zero, the
0N/A * remainder of the current byte is padded with 0s
0N/A * and written out first. The bit offset will be 0 after the
0N/A * write. Implementers can use the
0N/A * {@link ImageOutputStreamImpl#flushBits <code>flushBits</code>}
0N/A * method of {@link ImageOutputStreamImpl
0N/A * <code>ImageOutputStreamImpl</code>} to guarantee this.
0N/A *
0N/A * @param b an <code>int</code> whose lower 8 bits are to be
0N/A * written.
0N/A *
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void write(int b) throws IOException;
0N/A
0N/A /**
0N/A * Writes a sequence of bytes to the stream at the current
0N/A * position. If <code>b.length</code> is 0, nothing is written.
0N/A * The byte <code>b[0]</code> is written first, then the byte
0N/A * <code>b[1]</code>, and so on.
0N/A *
0N/A * <p> If the bit offset within the stream is non-zero, the
0N/A * remainder of the current byte is padded with 0s
0N/A * and written out first. The bit offset will be 0 after the
0N/A * write.
0N/A *
0N/A * @param b an array of <code>byte</code>s to be written.
0N/A *
0N/A * @exception NullPointerException if <code>b</code> is
0N/A * <code>null</code>.
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void write(byte b[]) throws IOException;
0N/A
0N/A /**
0N/A * Writes a sequence of bytes to the stream at the current
0N/A * position. If <code>len</code> is 0, nothing is written.
0N/A * The byte <code>b[off]</code> is written first, then the byte
0N/A * <code>b[off + 1]</code>, and so on.
0N/A *
0N/A * <p> If the bit offset within the stream is non-zero, the
0N/A * remainder of the current byte is padded with 0s
0N/A * and written out first. The bit offset will be 0 after the
0N/A * write. Implementers can use the
0N/A * {@link ImageOutputStreamImpl#flushBits <code>flushBits</code>}
0N/A * method of {@link ImageOutputStreamImpl
0N/A * <code>ImageOutputStreamImpl</code>} to guarantee this.
0N/A *
0N/A * @param b an array of <code>byte</code>s to be written.
0N/A * @param off the start offset in the data.
0N/A * @param len the number of <code>byte</code>s to write.
0N/A *
0N/A * @exception IndexOutOfBoundsException if <code>off</code> is
0N/A * negative, <code>len</code> is negative, or <code>off +
0N/A * len</code> is greater than <code>b.length</code>.
0N/A * @exception NullPointerException if <code>b</code> is
0N/A * <code>null</code>.
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void write(byte b[], int off, int len) throws IOException;
0N/A
0N/A /**
0N/A * Writes a <code>boolean</code> value to the stream. If
0N/A * <code>v</code> is true, the value <code>(byte)1</code> is
0N/A * written; if <code>v</code> is false, the value
0N/A * <code>(byte)0</code> is written.
0N/A *
0N/A * <p> If the bit offset within the stream is non-zero, the
0N/A * remainder of the current byte is padded with 0s
0N/A * and written out first. The bit offset will be 0 after the
0N/A * write.
0N/A *
0N/A * @param v the <code>boolean</code> to be written.
0N/A *
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void writeBoolean(boolean v) throws IOException;
0N/A
0N/A /**
0N/A * Writes the 8 low-order bits of <code>v</code> to the
0N/A * stream. The 24 high-order bits of <code>v</code> are ignored.
0N/A * (This means that <code>writeByte</code> does exactly the same
0N/A * thing as <code>write</code> for an integer argument.)
0N/A *
0N/A * <p> If the bit offset within the stream is non-zero, the
0N/A * remainder of the current byte is padded with 0s
0N/A * and written out first. The bit offset will be 0 after the
0N/A * write.
0N/A *
0N/A * @param v an <code>int</code> containing the byte value to be
0N/A * written.
0N/A *
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void writeByte(int v) throws IOException;
0N/A
0N/A /**
0N/A * Writes the 16 low-order bits of <code>v</code> to the
0N/A * stream. The 16 high-order bits of <code>v</code> are ignored.
0N/A * If the stream uses network byte order, the bytes written, in
0N/A * order, will be:
0N/A *
0N/A * <pre>
0N/A * (byte)((v &gt;&gt; 8) &amp; 0xff)
0N/A * (byte)(v &amp; 0xff)
0N/A * </pre>
0N/A *
0N/A * Otherwise, the bytes written will be:
0N/A *
0N/A * <pre>
0N/A * (byte)(v &amp; 0xff)
0N/A * (byte)((v &gt;&gt; 8) &amp; 0xff)
0N/A * </pre>
0N/A *
0N/A * <p> If the bit offset within the stream is non-zero, the
0N/A * remainder of the current byte is padded with 0s
0N/A * and written out first. The bit offset will be 0 after the
0N/A * write.
0N/A *
0N/A * @param v an <code>int</code> containing the short value to be
0N/A * written.
0N/A *
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void writeShort(int v) throws IOException;
0N/A
0N/A /**
0N/A * This method is a synonym for
0N/A * {@link #writeShort <code>writeShort</code>}.
0N/A *
0N/A * @param v an <code>int</code> containing the char (unsigned
0N/A * short) value to be written.
0N/A *
0N/A * @exception IOException if an I/O error occurs.
0N/A *
0N/A * @see #writeShort(int)
0N/A */
0N/A void writeChar(int v) throws IOException;
0N/A
0N/A /**
0N/A * Writes the 32 bits of <code>v</code> to the stream. If the
0N/A * stream uses network byte order, the bytes written, in order,
0N/A * will be:
0N/A *
0N/A * <pre>
0N/A * (byte)((v &gt;&gt; 24) &amp; 0xff)
0N/A * (byte)((v &gt;&gt; 16) &amp; 0xff)
0N/A * (byte)((v &gt;&gt; 8) &amp; 0xff)
0N/A * (byte)(v &amp; 0xff)
0N/A * </pre>
0N/A *
0N/A * Otheriwse, the bytes written will be:
0N/A *
0N/A * <pre>
0N/A * (byte)(v &amp; 0xff)
0N/A * (byte)((v &gt;&gt; 8) &amp; 0xff)
0N/A * (byte)((v &gt;&gt; 16) &amp; 0xff)
0N/A * (byte)((v &gt;&gt; 24) &amp; 0xff)
0N/A * </pre>
0N/A *
0N/A * <p> If the bit offset within the stream is non-zero, the
0N/A * remainder of the current byte is padded with 0s
0N/A * and written out first. The bit offset will be 0 after the
0N/A * write.
0N/A *
0N/A * @param v an <code>int</code> containing the value to be
0N/A * written.
0N/A *
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void writeInt(int v) throws IOException;
0N/A
0N/A /**
0N/A * Writes the 64 bits of <code>v</code> to the stream. If the
0N/A * stream uses network byte order, the bytes written, in order,
0N/A * will be:
0N/A *
0N/A * <pre>
0N/A * (byte)((v &gt;&gt; 56) &amp; 0xff)
0N/A * (byte)((v &gt;&gt; 48) &amp; 0xff)
0N/A * (byte)((v &gt;&gt; 40) &amp; 0xff)
0N/A * (byte)((v &gt;&gt; 32) &amp; 0xff)
0N/A * (byte)((v &gt;&gt; 24) &amp; 0xff)
0N/A * (byte)((v &gt;&gt; 16) &amp; 0xff)
0N/A * (byte)((v &gt;&gt; 8) &amp; 0xff)
0N/A * (byte)(v &amp; 0xff)
0N/A * </pre>
0N/A *
0N/A * Otherwise, the bytes written will be:
0N/A *
0N/A * <pre>
0N/A * (byte)(v &amp; 0xff)
0N/A * (byte)((v &gt;&gt; 8) &amp; 0xff)
0N/A * (byte)((v &gt;&gt; 16) &amp; 0xff)
0N/A * (byte)((v &gt;&gt; 24) &amp; 0xff)
0N/A * (byte)((v &gt;&gt; 32) &amp; 0xff)
0N/A * (byte)((v &gt;&gt; 40) &amp; 0xff)
0N/A * (byte)((v &gt;&gt; 48) &amp; 0xff)
0N/A * (byte)((v &gt;&gt; 56) &amp; 0xff)
0N/A * </pre>
0N/A *
0N/A * <p> If the bit offset within the stream is non-zero, the
0N/A * remainder of the current byte is padded with 0s
0N/A * and written out first. The bit offset will be 0 after the
0N/A * write.
0N/A *
0N/A * @param v a <code>long</code> containing the value to be
0N/A * written.
0N/A *
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void writeLong(long v) throws IOException;
0N/A
0N/A /**
0N/A * Writes a <code>float</code> value, which is comprised of four
0N/A * bytes, to the output stream. It does this as if it first
0N/A * converts this <code>float</code> value to an <code>int</code>
0N/A * in exactly the manner of the <code>Float.floatToIntBits</code>
0N/A * method and then writes the int value in exactly the manner of
0N/A * the <code>writeInt</code> method.
0N/A *
0N/A * <p> If the bit offset within the stream is non-zero, the
0N/A * remainder of the current byte is padded with 0s
0N/A * and written out first. The bit offset will be 0 after the
0N/A * write.
0N/A *
0N/A * @param v a <code>float</code> containing the value to be
0N/A * written.
0N/A *
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void writeFloat(float v) throws IOException;
0N/A
0N/A /**
0N/A * Writes a <code>double</code> value, which is comprised of four
0N/A * bytes, to the output stream. It does this as if it first
0N/A * converts this <code>double</code> value to an <code>long</code>
0N/A * in exactly the manner of the
0N/A * <code>Double.doubleToLongBits</code> method and then writes the
0N/A * long value in exactly the manner of the <code>writeLong</code>
0N/A * method.
0N/A *
0N/A * <p> If the bit offset within the stream is non-zero, the
0N/A * remainder of the current byte is padded with 0s
0N/A * and written out first. The bit offset will be 0 after the
0N/A * write.
0N/A *
0N/A * @param v a <code>double</code> containing the value to be
0N/A * written.
0N/A *
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void writeDouble(double v) throws IOException;
0N/A
0N/A /**
0N/A * Writes a string to the output stream. For every character in
0N/A * the string <code>s</code>, taken in order, one byte is written
0N/A * to the output stream. If <code>s</code> is <code>null</code>, a
0N/A * <code>NullPointerException</code> is thrown.
0N/A *
0N/A * <p> If <code>s.length</code> is zero, then no bytes are
0N/A * written. Otherwise, the character <code>s[0]</code> is written
0N/A * first, then <code>s[1]</code>, and so on; the last character
0N/A * written is <code>s[s.length-1]</code>. For each character, one
0N/A * byte is written, the low-order byte, in exactly the manner of
0N/A * the <code>writeByte</code> method. The high-order eight bits of
0N/A * each character in the string are ignored.
0N/A *
0N/A * <p> If the bit offset within the stream is non-zero, the
0N/A * remainder of the current byte is padded with 0s
0N/A * and written out first. The bit offset will be 0 after the
0N/A * write.
0N/A *
0N/A * @param s a <code>String</code> containing the value to be
0N/A * written.
0N/A *
0N/A * @exception NullPointerException if <code>s</code> is
0N/A * <code>null</code>.
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void writeBytes(String s) throws IOException;
0N/A
0N/A /**
0N/A * Writes a string to the output stream. For every character in
0N/A * the string <code>s</code>, taken in order, two bytes are
0N/A * written to the output stream, ordered according to the current
0N/A * byte order setting. If network byte order is being used, the
0N/A * high-order byte is written first; the order is reversed
0N/A * otherwise. If <code>s</code> is <code>null</code>, a
0N/A * <code>NullPointerException</code> is thrown.
0N/A *
0N/A * <p> If <code>s.length</code> is zero, then no bytes are
0N/A * written. Otherwise, the character <code>s[0]</code> is written
0N/A * first, then <code>s[1]</code>, and so on; the last character
0N/A * written is <code>s[s.length-1]</code>.
0N/A *
0N/A * <p> If the bit offset within the stream is non-zero, the
0N/A * remainder of the current byte is padded with 0s
0N/A * and written out first. The bit offset will be 0 after the
0N/A * write.
0N/A *
0N/A * @param s a <code>String</code> containing the value to be
0N/A * written.
0N/A *
0N/A * @exception NullPointerException if <code>s</code> is
0N/A * <code>null</code>.
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void writeChars(String s) throws IOException;
0N/A
0N/A /**
0N/A * Writes two bytes of length information to the output stream in
0N/A * network byte order, followed by the
0N/A * <a href="../../../java/io/DataInput.html#modified-utf-8">modified
0N/A * UTF-8</a>
0N/A * representation of every character in the string <code>s</code>.
0N/A * If <code>s</code> is <code>null</code>, a
0N/A * <code>NullPointerException</code> is thrown. Each character in
0N/A * the string <code>s</code> is converted to a group of one, two,
0N/A * or three bytes, depending on the value of the character.
0N/A *
0N/A * <p> If a character <code>c</code> is in the range
0N/A * <code>&#92;u0001</code> through <code>&#92;u007f</code>, it is
0N/A * represented by one byte:
0N/A *
0N/A * <p><pre>
0N/A * (byte)c
0N/A * </pre>
0N/A *
0N/A * <p> If a character <code>c</code> is <code>&#92;u0000</code> or
0N/A * is in the range <code>&#92;u0080</code> through
0N/A * <code>&#92;u07ff</code>, then it is represented by two bytes,
0N/A * to be written in the order shown:
0N/A *
0N/A * <p> <pre><code>
0N/A * (byte)(0xc0 | (0x1f &amp; (c &gt;&gt; 6)))
0N/A * (byte)(0x80 | (0x3f &amp; c))
0N/A * </code></pre>
0N/A *
0N/A * <p> If a character <code>c</code> is in the range
0N/A * <code>&#92;u0800</code> through <code>uffff</code>, then it is
0N/A * represented by three bytes, to be written in the order shown:
0N/A *
0N/A * <p> <pre><code>
0N/A * (byte)(0xe0 | (0x0f &amp; (c &gt;&gt; 12)))
0N/A * (byte)(0x80 | (0x3f &amp; (c &gt;&gt; 6)))
0N/A * (byte)(0x80 | (0x3f &amp; c))
0N/A * </code></pre>
0N/A *
0N/A * <p> First, the total number of bytes needed to represent all
0N/A * the characters of <code>s</code> is calculated. If this number
0N/A * is larger than <code>65535</code>, then a
0N/A * <code>UTFDataFormatException</code> is thrown. Otherwise, this
0N/A * length is written to the output stream in exactly the manner of
0N/A * the <code>writeShort</code> method; after this, the one-, two-,
0N/A * or three-byte representation of each character in the string
0N/A * <code>s</code> is written.
0N/A *
0N/A * <p> The current byte order setting is ignored.
0N/A *
0N/A * <p> If the bit offset within the stream is non-zero, the
0N/A * remainder of the current byte is padded with 0s
0N/A * and written out first. The bit offset will be 0 after the
0N/A * write.
0N/A *
0N/A * <p><strong>Note:</strong> This method should not be used in
0N/A * the implementation of image formats that use standard UTF-8,
0N/A * because the modified UTF-8 used here is incompatible with
0N/A * standard UTF-8.
0N/A *
0N/A * @param s a <code>String</code> containing the value to be
0N/A * written.
0N/A *
0N/A * @exception NullPointerException if <code>s</code> is
0N/A * <code>null</code>.
0N/A * @exception UTFDataFormatException if the modified UTF-8
0N/A * representation of <code>s</code> requires more than 65536 bytes.
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void writeUTF(String s) throws IOException;
0N/A
0N/A /**
0N/A * Writes a sequence of shorts to the stream at the current
0N/A * position. If <code>len</code> is 0, nothing is written.
0N/A * The short <code>s[off]</code> is written first, then the short
0N/A * <code>s[off + 1]</code>, and so on. The byte order of the
0N/A * stream is used to determine the order in which the individual
0N/A * bytes are written.
0N/A *
0N/A * <p> If the bit offset within the stream is non-zero, the
0N/A * remainder of the current byte is padded with 0s
0N/A * and written out first. The bit offset will be 0 after the
0N/A * write.
0N/A *
0N/A * @param s an array of <code>short</code>s to be written.
0N/A * @param off the start offset in the data.
0N/A * @param len the number of <code>short</code>s to write.
0N/A *
0N/A * @exception IndexOutOfBoundsException if <code>off</code> is
0N/A * negative, <code>len</code> is negative, or <code>off +
0N/A * len</code> is greater than <code>s.length</code>.
0N/A * @exception NullPointerException if <code>s</code> is
0N/A * <code>null</code>.
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void writeShorts(short[] s, int off, int len) throws IOException;
0N/A
0N/A /**
0N/A * Writes a sequence of chars to the stream at the current
0N/A * position. If <code>len</code> is 0, nothing is written.
0N/A * The char <code>c[off]</code> is written first, then the char
0N/A * <code>c[off + 1]</code>, and so on. The byte order of the
0N/A * stream is used to determine the order in which the individual
0N/A * bytes are written.
0N/A *
0N/A * <p> If the bit offset within the stream is non-zero, the
0N/A * remainder of the current byte is padded with 0s
0N/A * and written out first. The bit offset will be 0 after the
0N/A * write.
0N/A *
0N/A * @param c an array of <code>char</code>s to be written.
0N/A * @param off the start offset in the data.
0N/A * @param len the number of <code>char</code>s to write.
0N/A *
0N/A * @exception IndexOutOfBoundsException if <code>off</code> is
0N/A * negative, <code>len</code> is negative, or <code>off +
0N/A * len</code> is greater than <code>c.length</code>.
0N/A * @exception NullPointerException if <code>c</code> is
0N/A * <code>null</code>.
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void writeChars(char[] c, int off, int len) throws IOException;
0N/A
0N/A /**
0N/A * Writes a sequence of ints to the stream at the current
0N/A * position. If <code>len</code> is 0, nothing is written.
0N/A * The int <code>i[off]</code> is written first, then the int
0N/A * <code>i[off + 1]</code>, and so on. The byte order of the
0N/A * stream is used to determine the order in which the individual
0N/A * bytes are written.
0N/A *
0N/A * <p> If the bit offset within the stream is non-zero, the
0N/A * remainder of the current byte is padded with 0s
0N/A * and written out first. The bit offset will be 0 after the
0N/A * write.
0N/A *
0N/A * @param i an array of <code>int</code>s to be written.
0N/A * @param off the start offset in the data.
0N/A * @param len the number of <code>int</code>s to write.
0N/A *
0N/A * @exception IndexOutOfBoundsException if <code>off</code> is
0N/A * negative, <code>len</code> is negative, or <code>off +
0N/A * len</code> is greater than <code>i.length</code>.
0N/A * @exception NullPointerException if <code>i</code> is
0N/A * <code>null</code>.
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void writeInts(int[] i, int off, int len) throws IOException;
0N/A
0N/A /**
0N/A * Writes a sequence of longs to the stream at the current
0N/A * position. If <code>len</code> is 0, nothing is written.
0N/A * The long <code>l[off]</code> is written first, then the long
0N/A * <code>l[off + 1]</code>, and so on. The byte order of the
0N/A * stream is used to determine the order in which the individual
0N/A * bytes are written.
0N/A *
0N/A * <p> If the bit offset within the stream is non-zero, the
0N/A * remainder of the current byte is padded with 0s
0N/A * and written out first. The bit offset will be 0 after the
0N/A * write.
0N/A *
0N/A * @param l an array of <code>long</code>s to be written.
0N/A * @param off the start offset in the data.
0N/A * @param len the number of <code>long</code>s to write.
0N/A *
0N/A * @exception IndexOutOfBoundsException if <code>off</code> is
0N/A * negative, <code>len</code> is negative, or <code>off +
0N/A * len</code> is greater than <code>l.length</code>.
0N/A * @exception NullPointerException if <code>l</code> is
0N/A * <code>null</code>.
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void writeLongs(long[] l, int off, int len) throws IOException;
0N/A
0N/A /**
0N/A * Writes a sequence of floats to the stream at the current
0N/A * position. If <code>len</code> is 0, nothing is written.
0N/A * The float <code>f[off]</code> is written first, then the float
0N/A * <code>f[off + 1]</code>, and so on. The byte order of the
0N/A * stream is used to determine the order in which the individual
0N/A * bytes are written.
0N/A *
0N/A * <p> If the bit offset within the stream is non-zero, the
0N/A * remainder of the current byte is padded with 0s
0N/A * and written out first. The bit offset will be 0 after the
0N/A * write.
0N/A *
0N/A * @param f an array of <code>float</code>s to be written.
0N/A * @param off the start offset in the data.
0N/A * @param len the number of <code>float</code>s to write.
0N/A *
0N/A * @exception IndexOutOfBoundsException if <code>off</code> is
0N/A * negative, <code>len</code> is negative, or <code>off +
0N/A * len</code> is greater than <code>f.length</code>.
0N/A * @exception NullPointerException if <code>f</code> is
0N/A * <code>null</code>.
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void writeFloats(float[] f, int off, int len) throws IOException;
0N/A
0N/A /**
0N/A * Writes a sequence of doubles to the stream at the current
0N/A * position. If <code>len</code> is 0, nothing is written.
0N/A * The double <code>d[off]</code> is written first, then the double
0N/A * <code>d[off + 1]</code>, and so on. The byte order of the
0N/A * stream is used to determine the order in which the individual
0N/A * bytes are written.
0N/A *
0N/A * <p> If the bit offset within the stream is non-zero, the
0N/A * remainder of the current byte is padded with 0s
0N/A * and written out first. The bit offset will be 0 after the
0N/A * write.
0N/A *
0N/A * @param d an array of <code>doubles</code>s to be written.
0N/A * @param off the start offset in the data.
0N/A * @param len the number of <code>double</code>s to write.
0N/A *
0N/A * @exception IndexOutOfBoundsException if <code>off</code> is
0N/A * negative, <code>len</code> is negative, or <code>off +
0N/A * len</code> is greater than <code>d.length</code>.
0N/A * @exception NullPointerException if <code>d</code> is
0N/A * <code>null</code>.
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void writeDoubles(double[] d, int off, int len) throws IOException;
0N/A
0N/A /**
0N/A * Writes a single bit, given by the least significant bit of the
0N/A * argument, to the stream at the current bit offset within the
0N/A * current byte position. The upper 31 bits of the argument are
0N/A * ignored. The given bit replaces the previous bit at that
0N/A * position. The bit offset is advanced by one and reduced modulo
0N/A * 8.
0N/A *
0N/A * <p> If any bits of a particular byte have never been set
0N/A * at the time the byte is flushed to the destination, those
0N/A * bits will be set to 0 automatically.
0N/A *
0N/A * @param bit an <code>int</code> whose least significant bit
0N/A * is to be written to the stream.
0N/A *
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void writeBit(int bit) throws IOException;
0N/A
0N/A /**
0N/A * Writes a sequence of bits, given by the <code>numBits</code>
0N/A * least significant bits of the <code>bits</code> argument in
0N/A * left-to-right order, to the stream at the current bit offset
0N/A * within the current byte position. The upper <code>64 -
0N/A * numBits</code> bits of the argument are ignored. The bit
0N/A * offset is advanced by <code>numBits</code> and reduced modulo
0N/A * 8. Note that a bit offset of 0 always indicates the
0N/A * most-significant bit of the byte, and bytes of bits are written
0N/A * out in sequence as they are encountered. Thus bit writes are
0N/A * always effectively in network byte order. The actual stream
0N/A * byte order setting is ignored.
0N/A *
0N/A * <p> Bit data may be accumulated in memory indefinitely, until
0N/A * <code>flushBefore</code> is called. At that time, all bit data
0N/A * prior to the flushed position will be written.
0N/A *
0N/A * <p> If any bits of a particular byte have never been set
0N/A * at the time the byte is flushed to the destination, those
0N/A * bits will be set to 0 automatically.
0N/A *
0N/A * @param bits a <code>long</code> containing the bits to be
0N/A * written, starting with the bit in position <code>numBits -
0N/A * 1</code> down to the least significant bit.
0N/A *
0N/A * @param numBits an <code>int</code> between 0 and 64, inclusive.
0N/A *
0N/A * @exception IllegalArgumentException if <code>numBits</code> is
0N/A * not between 0 and 64, inclusive.
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void writeBits(long bits, int numBits) throws IOException;
0N/A
0N/A /**
0N/A * Flushes all data prior to the given position to the underlying
0N/A * destination, such as an <code>OutputStream</code> or
0N/A * <code>File</code>. Attempting to seek to the flushed portion
0N/A * of the stream will result in an
0N/A * <code>IndexOutOfBoundsException</code>.
0N/A *
0N/A * @param pos a <code>long</code> containing the length of the
0N/A * stream prefix that may be flushed to the destination.
0N/A *
0N/A * @exception IndexOutOfBoundsException if <code>pos</code> lies
0N/A * in the flushed portion of the stream or past the current stream
0N/A * position.
0N/A * @exception IOException if an I/O error occurs.
0N/A */
0N/A void flushBefore(long pos) throws IOException;
0N/A}