KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > imageio > stream > ImageOutputStream


1 /*
2  * @(#)ImageOutputStream.java 1.24 04/05/13
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.imageio.stream;
9
10 import java.io.DataOutput JavaDoc;
11 import java.io.IOException JavaDoc;
12 import java.io.UTFDataFormatException JavaDoc;
13
14 /**
15  * A seekable output stream interface for use by
16  * <code>ImageWriter</code>s. Various output destinations, such as
17  * <code>OutputStream</code>s and <code>File</code>s, as well as
18  * future fast I/O destinations may be "wrapped" by a suitable
19  * implementation of this interface for use by the Image I/O API.
20  *
21  * <p> Unlike a standard <code>OutputStream</code>, ImageOutputStream
22  * extends its counterpart, <code>ImageInputStream</code>. Thus it is
23  * possible to read from the stream as it is being written. The same
24  * seek and flush positions apply to both reading and writing, although
25  * the semantics for dealing with a non-zero bit offset before a byte-aligned
26  * write are necessarily different from the semantics for dealing with
27  * a non-zero bit offset before a byte-aligned read. When reading bytes,
28  * any bit offset is set to 0 before the read; when writing bytes, a
29  * non-zero bit offset causes the remaining bits in the byte to be written
30  * as 0s. The byte-aligned write then starts at the next byte position.
31  *
32  * @see ImageInputStream
33  *
34  * @version 0.5
35  */

36 public interface ImageOutputStream extends ImageInputStream JavaDoc, DataOutput JavaDoc {
37     
38     /**
39      * Writes a single byte to the stream at the current position.
40      * The 24 high-order bits of <code>b</code> are ignored.
41      *
42      * <p> If the bit offset within the stream is non-zero, the
43      * remainder of the current byte is padded with 0s
44      * and written out first. The bit offset will be 0 after the
45      * write. Implementers can use the
46      * {@link ImageOutputStreamImpl#flushBits <code>flushBits</code>}
47      * method of {@link ImageOutputStreamImpl
48      * <code>ImageOutputStreamImpl</code>} to guarantee this.
49      *
50      * @param b an <code>int</code> whose lower 8 bits are to be
51      * written.
52      *
53      * @exception IOException if an I/O error occurs.
54      */

55     void write(int b) throws IOException JavaDoc;
56
57     /**
58      * Writes a sequence of bytes to the stream at the current
59      * position. If <code>b.length</code> is 0, nothing is written.
60      * The byte <code>b[0]</code> is written first, then the byte
61      * <code>b[1]</code>, and so on.
62      *
63      * <p> If the bit offset within the stream is non-zero, the
64      * remainder of the current byte is padded with 0s
65      * and written out first. The bit offset will be 0 after the
66      * write.
67      *
68      * @param b an array of <code>byte</code>s to be written.
69      *
70      * @exception NullPointerException if <code>b</code> is
71      * <code>null</code>.
72      * @exception IOException if an I/O error occurs.
73      */

74     void write(byte b[]) throws IOException JavaDoc;
75
76     /**
77      * Writes a sequence of bytes to the stream at the current
78      * position. If <code>len</code> is 0, nothing is written.
79      * The byte <code>b[off]</code> is written first, then the byte
80      * <code>b[off + 1]</code>, and so on.
81      *
82      * <p> If the bit offset within the stream is non-zero, the
83      * remainder of the current byte is padded with 0s
84      * and written out first. The bit offset will be 0 after the
85      * write. Implementers can use the
86      * {@link ImageOutputStreamImpl#flushBits <code>flushBits</code>}
87      * method of {@link ImageOutputStreamImpl
88      * <code>ImageOutputStreamImpl</code>} to guarantee this.
89      *
90      * @param b an array of <code>byte</code>s to be written.
91      * @param off the start offset in the data.
92      * @param len the number of <code>byte</code>s to write.
93      *
94      * @exception IndexOutOfBoundsException if <code>off</code> is
95      * negative, <code>len</code> is negative, or <code>off +
96      * len</code> is greater than <code>b.length</code>.
97      * @exception NullPointerException if <code>b</code> is
98      * <code>null</code>.
99      * @exception IOException if an I/O error occurs.
100      */

101     void write(byte b[], int off, int len) throws IOException JavaDoc;
102
103     /**
104      * Writes a <code>boolean</code> value to the stream. If
105      * <code>v</code> is true, the value <code>(byte)1</code> is
106      * written; if <code>v</code> is false, the value
107      * <code>(byte)0</code> is written.
108      *
109      * <p> If the bit offset within the stream is non-zero, the
110      * remainder of the current byte is padded with 0s
111      * and written out first. The bit offset will be 0 after the
112      * write.
113      *
114      * @param v the <code>boolean</code> to be written.
115      *
116      * @exception IOException if an I/O error occurs.
117      */

118     void writeBoolean(boolean v) throws IOException JavaDoc;
119
120     /**
121      * Writes the 8 low-order bits of <code>v</code> to the
122      * stream. The 24 high-order bits of <code>v</code> are ignored.
123      * (This means that <code>writeByte</code> does exactly the same
124      * thing as <code>write</code> for an integer argument.)
125      *
126      * <p> If the bit offset within the stream is non-zero, the
127      * remainder of the current byte is padded with 0s
128      * and written out first. The bit offset will be 0 after the
129      * write.
130      *
131      * @param v an <code>int</code> containing the byte value to be
132      * written.
133      *
134      * @exception IOException if an I/O error occurs.
135      */

136     void writeByte(int v) throws IOException JavaDoc;
137
138     /**
139      * Writes the 16 low-order bits of <code>v</code> to the
140      * stream. The 16 high-order bits of <code>v</code> are ignored.
141      * If the stream uses network byte order, the bytes written, in
142      * order, will be:
143      *
144      * <pre>
145      * (byte)((v &gt;&gt; 8) &amp; 0xff)
146      * (byte)(v &amp; 0xff)
147      * </pre>
148      *
149      * Otherwise, the bytes written will be:
150      *
151      * <pre>
152      * (byte)(v &amp; 0xff)
153      * (byte)((v &gt;&gt; 8) &amp; 0xff)
154      * </pre>
155      *
156      * <p> If the bit offset within the stream is non-zero, the
157      * remainder of the current byte is padded with 0s
158      * and written out first. The bit offset will be 0 after the
159      * write.
160      *
161      * @param v an <code>int</code> containing the short value to be
162      * written.
163      *
164      * @exception IOException if an I/O error occurs.
165      */

166     void writeShort(int v) throws IOException JavaDoc;
167
168     /**
169      * This method is a synonym for
170      * {@link #writeShort <code>writeShort</code>}.
171      *
172      * @param v an <code>int</code> containing the char (unsigned
173      * short) value to be written.
174      *
175      * @exception IOException if an I/O error occurs.
176      *
177      * @see #writeShort(int)
178      */

179     void writeChar(int v) throws IOException JavaDoc;
180
181     /**
182      * Writes the 32 bits of <code>v</code> to the stream. If the
183      * stream uses network byte order, the bytes written, in order,
184      * will be:
185      *
186      * <pre>
187      * (byte)((v &gt;&gt; 24) &amp; 0xff)
188      * (byte)((v &gt;&gt; 16) &amp; 0xff)
189      * (byte)((v &gt;&gt; 8) &amp; 0xff)
190      * (byte)(v &amp; 0xff)
191      * </pre>
192      *
193      * Otheriwse, the bytes written will be:
194      *
195      * <pre>
196      * (byte)(v &amp; 0xff)
197      * (byte)((v &gt;&gt; 8) &amp; 0xff)
198      * (byte)((v &gt;&gt; 16) &amp; 0xff)
199      * (byte)((v &gt;&gt; 24) &amp; 0xff)
200      * </pre>
201      *
202      * <p> If the bit offset within the stream is non-zero, the
203      * remainder of the current byte is padded with 0s
204      * and written out first. The bit offset will be 0 after the
205      * write.
206      *
207      * @param v an <code>int</code> containing the value to be
208      * written.
209      *
210      * @exception IOException if an I/O error occurs.
211      */

212     void writeInt(int v) throws IOException JavaDoc;
213
214     /**
215      * Writes the 64 bits of <code>v</code> to the stream. If the
216      * stream uses network byte order, the bytes written, in order,
217      * will be:
218      *
219      * <pre>
220      * (byte)((v &gt;&gt; 56) &amp; 0xff)
221      * (byte)((v &gt;&gt; 48) &amp; 0xff)
222      * (byte)((v &gt;&gt; 40) &amp; 0xff)
223      * (byte)((v &gt;&gt; 32) &amp; 0xff)
224      * (byte)((v &gt;&gt; 24) &amp; 0xff)
225      * (byte)((v &gt;&gt; 16) &amp; 0xff)
226      * (byte)((v &gt;&gt; 8) &amp; 0xff)
227      * (byte)(v &amp; 0xff)
228      * </pre>
229      *
230      * Otherwise, the bytes written will be:
231      *
232      * <pre>
233      * (byte)(v &amp; 0xff)
234      * (byte)((v &gt;&gt; 8) &amp; 0xff)
235      * (byte)((v &gt;&gt; 16) &amp; 0xff)
236      * (byte)((v &gt;&gt; 24) &amp; 0xff)
237      * (byte)((v &gt;&gt; 32) &amp; 0xff)
238      * (byte)((v &gt;&gt; 40) &amp; 0xff)
239      * (byte)((v &gt;&gt; 48) &amp; 0xff)
240      * (byte)((v &gt;&gt; 56) &amp; 0xff)
241      * </pre>
242      *
243      * <p> If the bit offset within the stream is non-zero, the
244      * remainder of the current byte is padded with 0s
245      * and written out first. The bit offset will be 0 after the
246      * write.
247      *
248      * @param v a <code>long</code> containing the value to be
249      * written.
250      *
251      * @exception IOException if an I/O error occurs.
252      */

253     void writeLong(long v) throws IOException JavaDoc;
254
255     /**
256      * Writes a <code>float</code> value, which is comprised of four
257      * bytes, to the output stream. It does this as if it first
258      * converts this <code>float</code> value to an <code>int</code>
259      * in exactly the manner of the <code>Float.floatToIntBits</code>
260      * method and then writes the int value in exactly the manner of
261      * the <code>writeInt</code> method.
262      *
263      * <p> If the bit offset within the stream is non-zero, the
264      * remainder of the current byte is padded with 0s
265      * and written out first. The bit offset will be 0 after the
266      * write.
267      *
268      * @param v a <code>float</code> containing the value to be
269      * written.
270      *
271      * @exception IOException if an I/O error occurs.
272      */

273     void writeFloat(float v) throws IOException JavaDoc;
274
275     /**
276      * Writes a <code>double</code> value, which is comprised of four
277      * bytes, to the output stream. It does this as if it first
278      * converts this <code>double</code> value to an <code>long</code>
279      * in exactly the manner of the
280      * <code>Double.doubleToLongBits</code> method and then writes the
281      * long value in exactly the manner of the <code>writeLong</code>
282      * method.
283      *
284      * <p> If the bit offset within the stream is non-zero, the
285      * remainder of the current byte is padded with 0s
286      * and written out first. The bit offset will be 0 after the
287      * write.
288      *
289      * @param v a <code>double</code> containing the value to be
290      * written.
291      *
292      * @exception IOException if an I/O error occurs.
293      */

294     void writeDouble(double v) throws IOException JavaDoc;
295
296     /**
297      * Writes a string to the output stream. For every character in
298      * the string <code>s</code>, taken in order, one byte is written
299      * to the output stream. If <code>s</code> is <code>null</code>, a
300      * <code>NullPointerException</code> is thrown.
301      *
302      * <p> If <code>s.length</code> is zero, then no bytes are
303      * written. Otherwise, the character <code>s[0]</code> is written
304      * first, then <code>s[1]</code>, and so on; the last character
305      * written is <code>s[s.length-1]</code>. For each character, one
306      * byte is written, the low-order byte, in exactly the manner of
307      * the <code>writeByte</code> method. The high-order eight bits of
308      * each character in the string are ignored.
309      *
310      * <p> If the bit offset within the stream is non-zero, the
311      * remainder of the current byte is padded with 0s
312      * and written out first. The bit offset will be 0 after the
313      * write.
314      *
315      * @param s a <code>String</code> containing the value to be
316      * written.
317      *
318      * @exception NullPointerException if <code>s</code> is
319      * <code>null</code>.
320      * @exception IOException if an I/O error occurs.
321      */

322     void writeBytes(String JavaDoc s) throws IOException JavaDoc;
323
324     /**
325      * Writes a string to the output stream. For every character in
326      * the string <code>s</code>, taken in order, two bytes are
327      * written to the output stream, ordered according to the current
328      * byte order setting. If network byte order is being used, the
329      * high-order byte is written first; the order is reversed
330      * otherwise. If <code>s</code> is <code>null</code>, a
331      * <code>NullPointerException</code> is thrown.
332      *
333      * <p> If <code>s.length</code> is zero, then no bytes are
334      * written. Otherwise, the character <code>s[0]</code> is written
335      * first, then <code>s[1]</code>, and so on; the last character
336      * written is <code>s[s.length-1]</code>.
337      *
338      * <p> If the bit offset within the stream is non-zero, the
339      * remainder of the current byte is padded with 0s
340      * and written out first. The bit offset will be 0 after the
341      * write.
342      *
343      * @param s a <code>String</code> containing the value to be
344      * written.
345      *
346      * @exception NullPointerException if <code>s</code> is
347      * <code>null</code>.
348      * @exception IOException if an I/O error occurs.
349      */

350     void writeChars(String JavaDoc s) throws IOException JavaDoc;
351
352     /**
353      * Writes two bytes of length information to the output stream in
354      * network byte order, followed by the
355      * <a HREF="../../../java/io/DataInput.html#modified-utf-8">modified
356      * UTF-8</a>
357      * representation of every character in the string <code>s</code>.
358      * If <code>s</code> is <code>null</code>, a
359      * <code>NullPointerException</code> is thrown. Each character in
360      * the string <code>s</code> is converted to a group of one, two,
361      * or three bytes, depending on the value of the character.
362      *
363      * <p> If a character <code>c</code> is in the range
364      * <code>&#92;u0001</code> through <code>&#92;u007f</code>, it is
365      * represented by one byte:
366      *
367      * <p><pre>
368      * (byte)c
369      * </pre>
370      *
371      * <p> If a character <code>c</code> is <code>&#92;u0000</code> or
372      * is in the range <code>&#92;u0080</code> through
373      * <code>&#92;u07ff</code>, then it is represented by two bytes,
374      * to be written in the order shown:
375      *
376      * <p> <pre><code>
377      * (byte)(0xc0 | (0x1f &amp; (c &gt;&gt; 6)))
378      * (byte)(0x80 | (0x3f &amp; c))
379      * </code></pre>
380      *
381      * <p> If a character <code>c</code> is in the range
382      * <code>&#92;u0800</code> through <code>uffff</code>, then it is
383      * represented by three bytes, to be written in the order shown:
384      *
385      * <p> <pre><code>
386      * (byte)(0xe0 | (0x0f &amp; (c &gt;&gt; 12)))
387      * (byte)(0x80 | (0x3f &amp; (c &gt;&gt; 6)))
388      * (byte)(0x80 | (0x3f &amp; c))
389      * </code></pre>
390      *
391      * <p> First, the total number of bytes needed to represent all
392      * the characters of <code>s</code> is calculated. If this number
393      * is larger than <code>65535</code>, then a
394      * <code>UTFDataFormatException</code> is thrown. Otherwise, this
395      * length is written to the output stream in exactly the manner of
396      * the <code>writeShort</code> method; after this, the one-, two-,
397      * or three-byte representation of each character in the string
398      * <code>s</code> is written.
399      *
400      * <p> The current byte order setting is ignored.
401      *
402      * <p> If the bit offset within the stream is non-zero, the
403      * remainder of the current byte is padded with 0s
404      * and written out first. The bit offset will be 0 after the
405      * write.
406      *
407      * <p><strong>Note:</strong> This method should not be used in
408      * the implementation of image formats that use standard UTF-8,
409      * because the modified UTF-8 used here is incompatible with
410      * standard UTF-8.
411      *
412      * @param s a <code>String</code> containing the value to be
413      * written.
414      *
415      * @exception NullPointerException if <code>s</code> is
416      * <code>null</code>.
417      * @exception UTFDataFormatException if the modified UTF-8
418      * representation of <code>s</code> requires more than 65536 bytes.
419      * @exception IOException if an I/O error occurs.
420      */

421     void writeUTF(String JavaDoc s) throws IOException JavaDoc;
422
423     /**
424      * Writes a sequence of shorts to the stream at the current
425      * position. If <code>len</code> is 0, nothing is written.
426      * The short <code>s[off]</code> is written first, then the short
427      * <code>s[off + 1]</code>, and so on. The byte order of the
428      * stream is used to determine the order in which the individual
429      * bytes are written.
430      *
431      * <p> If the bit offset within the stream is non-zero, the
432      * remainder of the current byte is padded with 0s
433      * and written out first. The bit offset will be 0 after the
434      * write.
435      *
436      * @param s an array of <code>short</code>s to be written.
437      * @param off the start offset in the data.
438      * @param len the number of <code>short</code>s to write.
439      *
440      * @exception IndexOutOfBoundsException if <code>off</code> is
441      * negative, <code>len</code> is negative, or <code>off +
442      * len</code> is greater than <code>s.length</code>.
443      * @exception NullPointerException if <code>s</code> is
444      * <code>null</code>.
445      * @exception IOException if an I/O error occurs.
446      */

447     void writeShorts(short[] s, int off, int len) throws IOException JavaDoc;
448
449     /**
450      * Writes a sequence of chars to the stream at the current
451      * position. If <code>len</code> is 0, nothing is written.
452      * The char <code>c[off]</code> is written first, then the char
453      * <code>c[off + 1]</code>, and so on. The byte order of the
454      * stream is used to determine the order in which the individual
455      * bytes are written.
456      *
457      * <p> If the bit offset within the stream is non-zero, the
458      * remainder of the current byte is padded with 0s
459      * and written out first. The bit offset will be 0 after the
460      * write.
461      *
462      * @param c an array of <code>char</code>s to be written.
463      * @param off the start offset in the data.
464      * @param len the number of <code>char</code>s to write.
465      *
466      * @exception IndexOutOfBoundsException if <code>off</code> is
467      * negative, <code>len</code> is negative, or <code>off +
468      * len</code> is greater than <code>c.length</code>.
469      * @exception NullPointerException if <code>c</code> is
470      * <code>null</code>.
471      * @exception IOException if an I/O error occurs.
472      */

473     void writeChars(char[] c, int off, int len) throws IOException JavaDoc;
474
475     /**
476      * Writes a sequence of ints to the stream at the current
477      * position. If <code>len</code> is 0, nothing is written.
478      * The int <code>i[off]</code> is written first, then the int
479      * <code>i[off + 1]</code>, and so on. The byte order of the
480      * stream is used to determine the order in which the individual
481      * bytes are written.
482      *
483      * <p> If the bit offset within the stream is non-zero, the
484      * remainder of the current byte is padded with 0s
485      * and written out first. The bit offset will be 0 after the
486      * write.
487      *
488      * @param i an array of <code>int</code>s to be written.
489      * @param off the start offset in the data.
490      * @param len the number of <code>int</code>s to write.
491      *
492      * @exception IndexOutOfBoundsException if <code>off</code> is
493      * negative, <code>len</code> is negative, or <code>off +
494      * len</code> is greater than <code>i.length</code>.
495      * @exception NullPointerException if <code>i</code> is
496      * <code>null</code>.
497      * @exception IOException if an I/O error occurs.
498      */

499     void writeInts(int[] i, int off, int len) throws IOException JavaDoc;
500
501     /**
502      * Writes a sequence of longs to the stream at the current
503      * position. If <code>len</code> is 0, nothing is written.
504      * The long <code>l[off]</code> is written first, then the long
505      * <code>l[off + 1]</code>, and so on. The byte order of the
506      * stream is used to determine the order in which the individual
507      * bytes are written.
508      *
509      * <p> If the bit offset within the stream is non-zero, the
510      * remainder of the current byte is padded with 0s
511      * and written out first. The bit offset will be 0 after the
512      * write.
513      *
514      * @param l an array of <code>long</code>s to be written.
515      * @param off the start offset in the data.
516      * @param len the number of <code>long</code>s to write.
517      *
518      * @exception IndexOutOfBoundsException if <code>off</code> is
519      * negative, <code>len</code> is negative, or <code>off +
520      * len</code> is greater than <code>l.length</code>.
521      * @exception NullPointerException if <code>l</code> is
522      * <code>null</code>.
523      * @exception IOException if an I/O error occurs.
524      */

525     void writeLongs(long[] l, int off, int len) throws IOException JavaDoc;
526
527     /**
528      * Writes a sequence of floats to the stream at the current
529      * position. If <code>len</code> is 0, nothing is written.
530      * The float <code>f[off]</code> is written first, then the float
531      * <code>f[off + 1]</code>, and so on. The byte order of the
532      * stream is used to determine the order in which the individual
533      * bytes are written.
534      *
535      * <p> If the bit offset within the stream is non-zero, the
536      * remainder of the current byte is padded with 0s
537      * and written out first. The bit offset will be 0 after the
538      * write.
539      *
540      * @param f an array of <code>float</code>s to be written.
541      * @param off the start offset in the data.
542      * @param len the number of <code>float</code>s to write.
543      *
544      * @exception IndexOutOfBoundsException if <code>off</code> is
545      * negative, <code>len</code> is negative, or <code>off +
546      * len</code> is greater than <code>f.length</code>.
547      * @exception NullPointerException if <code>f</code> is
548      * <code>null</code>.
549      * @exception IOException if an I/O error occurs.
550      */

551     void writeFloats(float[] f, int off, int len) throws IOException JavaDoc;
552
553     /**
554      * Writes a sequence of doubles to the stream at the current
555      * position. If <code>len</code> is 0, nothing is written.
556      * The double <code>d[off]</code> is written first, then the double
557      * <code>d[off + 1]</code>, and so on. The byte order of the
558      * stream is used to determine the order in which the individual
559      * bytes are written.
560      *
561      * <p> If the bit offset within the stream is non-zero, the
562      * remainder of the current byte is padded with 0s
563      * and written out first. The bit offset will be 0 after the
564      * write.
565      *
566      * @param d an array of <code>doubles</code>s to be written.
567      * @param off the start offset in the data.
568      * @param len the number of <code>double</code>s to write.
569      *
570      * @exception IndexOutOfBoundsException if <code>off</code> is
571      * negative, <code>len</code> is negative, or <code>off +
572      * len</code> is greater than <code>d.length</code>.
573      * @exception NullPointerException if <code>d</code> is
574      * <code>null</code>.
575      * @exception IOException if an I/O error occurs.
576      */

577     void writeDoubles(double[] d, int off, int len) throws IOException JavaDoc;
578
579     /**
580      * Writes a single bit, given by the least significant bit of the
581      * argument, to the stream at the current bit offset within the
582      * current byte position. The upper 31 bits of the argument are
583      * ignored. The given bit replaces the previous bit at that
584      * position. The bit offset is advanced by one and reduced modulo
585      * 8.
586      *
587      * <p> If any bits of a particular byte have never been set
588      * at the time the byte is flushed to the destination, those
589      * bits will be set to 0 automatically.
590      *
591      * @param bit an <code>int</code> whose least significant bit
592      * is to be written to the stream.
593      *
594      * @exception IOException if an I/O error occurs.
595      */

596     void writeBit(int bit) throws IOException JavaDoc;
597
598     /**
599      * Writes a sequence of bits, given by the <code>numBits</code>
600      * least significant bits of the <code>bits</code> argument in
601      * left-to-right order, to the stream at the current bit offset
602      * within the current byte position. The upper <code>64 -
603      * numBits</code> bits of the argument are ignored. The bit
604      * offset is advanced by <code>numBits</code> and reduced modulo
605      * 8. Note that a bit offset of 0 always indicates the
606      * most-significant bit of the byte, and bytes of bits are written
607      * out in sequence as they are encountered. Thus bit writes are
608      * always effectively in network byte order. The actual stream
609      * byte order setting is ignored.
610      *
611      * <p> Bit data may be accumulated in memory indefinitely, until
612      * <code>flushBefore</code> is called. At that time, all bit data
613      * prior to the flushed position will be written.
614      *
615      * <p> If any bits of a particular byte have never been set
616      * at the time the byte is flushed to the destination, those
617      * bits will be set to 0 automatically.
618      *
619      * @param bits a <code>long</code> containing the bits to be
620      * written, starting with the bit in position <code>numBits -
621      * 1</code> down to the least significant bit.
622      *
623      * @param numBits an <code>int</code> between 0 and 64, inclusive.
624      *
625      * @exception IllegalArgumentException if <code>numBits</code> is
626      * not between 0 and 64, inclusive.
627      * @exception IOException if an I/O error occurs.
628      */

629     void writeBits(long bits, int numBits) throws IOException JavaDoc;
630
631     /**
632      * Flushes all data prior to the given position to the underlying
633      * destination, such as an <code>OutputStream</code> or
634      * <code>File</code>. Attempting to seek to the flushed portion
635      * of the stream will result in an
636      * <code>IndexOutOfBoundsException</code>.
637      *
638      * @param pos a <code>long</code> containing the length of the
639      * file prefix that may be flushed to the destination.
640      *
641      * @exception IndexOutOfBoundsException if <code>pos</code> lies
642      * in the flushed portion of the stream or past the current stream
643      * position.
644      * @exception IOException if an I/O error occurs.
645      */

646     void flushBefore(long pos) throws IOException JavaDoc;
647 }
648
Popular Tags