Source Code Cross Referenced for ImageOutputStream.java in  » 6.0-JDK-Core » image » javax » imageio » stream » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » image » javax.imageio.stream 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025
026        package javax.imageio.stream;
027
028        import java.io.DataOutput;
029        import java.io.IOException;
030        import java.io.UTFDataFormatException;
031
032        /**
033         * A seekable output stream interface for use by
034         * <code>ImageWriter</code>s.  Various output destinations, such as
035         * <code>OutputStream</code>s and <code>File</code>s, as well as
036         * future fast I/O destinations may be "wrapped" by a suitable
037         * implementation of this interface for use by the Image I/O API.
038         *
039         * <p> Unlike a standard <code>OutputStream</code>, ImageOutputStream
040         * extends its counterpart, <code>ImageInputStream</code>.  Thus it is
041         * possible to read from the stream as it is being written.  The same
042         * seek and flush positions apply to both reading and writing, although
043         * the semantics for dealing with a non-zero bit offset before a byte-aligned
044         * write are necessarily different from the semantics for dealing with
045         * a non-zero bit offset before a byte-aligned read.  When reading bytes, 
046         * any bit offset is set to 0 before the read; when writing bytes, a
047         * non-zero bit offset causes the remaining bits in the byte to be written
048         * as 0s.  The byte-aligned write then starts at the next byte position.
049         *
050         * @see ImageInputStream
051         *
052         * @version 0.5
053         */
054        public interface ImageOutputStream extends ImageInputStream, DataOutput {
055
056            /**
057             * Writes a single byte to the stream at the current position.
058             * The 24 high-order bits of <code>b</code> are ignored.
059             *
060             * <p> If the bit offset within the stream is non-zero, the
061             * remainder of the current byte is padded with 0s
062             * and written out first.  The bit offset will be 0 after the
063             * write.  Implementers can use the 
064             * {@link ImageOutputStreamImpl#flushBits <code>flushBits</code>}
065             * method of {@link ImageOutputStreamImpl 
066             * <code>ImageOutputStreamImpl</code>} to guarantee this.
067             *
068             * @param b an <code>int</code> whose lower 8 bits are to be
069             * written.
070             *
071             * @exception IOException if an I/O error occurs.
072             */
073            void write(int b) throws IOException;
074
075            /**
076             * Writes a sequence of bytes to the stream at the current
077             * position.  If <code>b.length</code> is 0, nothing is written.
078             * The byte <code>b[0]</code> is written first, then the byte
079             * <code>b[1]</code>, and so on.
080             *
081             * <p> If the bit offset within the stream is non-zero, the
082             * remainder of the current byte is padded with 0s
083             * and written out first.  The bit offset will be 0 after the
084             * write.
085             *
086             * @param b an array of <code>byte</code>s to be written.
087             *
088             * @exception NullPointerException if <code>b</code> is
089             * <code>null</code>.
090             * @exception IOException if an I/O error occurs.
091             */
092            void write(byte b[]) throws IOException;
093
094            /**
095             * Writes a sequence of bytes to the stream at the current
096             * position.  If <code>len</code> is 0, nothing is written.
097             * The byte <code>b[off]</code> is written first, then the byte
098             * <code>b[off + 1]</code>, and so on.
099             *
100             * <p> If the bit offset within the stream is non-zero, the
101             * remainder of the current byte is padded with 0s
102             * and written out first.  The bit offset will be 0 after the
103             * write.  Implementers can use the 
104             * {@link ImageOutputStreamImpl#flushBits <code>flushBits</code>}
105             * method of {@link ImageOutputStreamImpl 
106             * <code>ImageOutputStreamImpl</code>} to guarantee this.
107             *
108             * @param b an array of <code>byte</code>s to be written.
109             * @param off the start offset in the data.
110             * @param len the number of <code>byte</code>s to write.
111             *
112             * @exception IndexOutOfBoundsException if <code>off</code> is
113             * negative, <code>len</code> is negative, or <code>off +
114             * len</code> is greater than <code>b.length</code>.
115             * @exception NullPointerException if <code>b</code> is
116             * <code>null</code>.
117             * @exception IOException if an I/O error occurs.
118             */
119            void write(byte b[], int off, int len) throws IOException;
120
121            /**
122             * Writes a <code>boolean</code> value to the stream.  If
123             * <code>v</code> is true, the value <code>(byte)1</code> is
124             * written; if <code>v</code> is false, the value
125             * <code>(byte)0</code> is written.
126             *
127             * <p> If the bit offset within the stream is non-zero, the
128             * remainder of the current byte is padded with 0s
129             * and written out first.  The bit offset will be 0 after the
130             * write.
131             *
132             * @param v the <code>boolean</code> to be written.
133             *
134             * @exception IOException if an I/O error occurs.
135             */
136            void writeBoolean(boolean v) throws IOException;
137
138            /**
139             * Writes the 8 low-order bits of <code>v</code> to the
140             * stream. The 24 high-order bits of <code>v</code> are ignored.
141             * (This means that <code>writeByte</code> does exactly the same
142             * thing as <code>write</code> for an integer argument.)
143             *
144             * <p> If the bit offset within the stream is non-zero, the
145             * remainder of the current byte is padded with 0s
146             * and written out first.  The bit offset will be 0 after the
147             * write.
148             *
149             * @param v an <code>int</code> containing the byte value to be
150             * written.
151             *
152             * @exception IOException if an I/O error occurs.
153             */
154            void writeByte(int v) throws IOException;
155
156            /**
157             * Writes the 16 low-order bits of <code>v</code> to the
158             * stream. The 16 high-order bits of <code>v</code> are ignored.
159             * If the stream uses network byte order, the bytes written, in
160             * order, will be:
161             *
162             * <pre>
163             * (byte)((v &gt;&gt; 8) &amp; 0xff)
164             * (byte)(v &amp; 0xff)
165             * </pre>
166             *
167             * Otherwise, the bytes written will be:
168             *
169             * <pre>
170             * (byte)(v &amp; 0xff)
171             * (byte)((v &gt;&gt; 8) &amp; 0xff)
172             * </pre>
173             *
174             * <p> If the bit offset within the stream is non-zero, the
175             * remainder of the current byte is padded with 0s
176             * and written out first.  The bit offset will be 0 after the
177             * write.
178             *
179             * @param v an <code>int</code> containing the short value to be
180             * written.
181             *
182             * @exception IOException if an I/O error occurs.
183             */
184            void writeShort(int v) throws IOException;
185
186            /**
187             * This method is a synonym for 
188             * {@link #writeShort <code>writeShort</code>}.
189             *
190             * @param v an <code>int</code> containing the char (unsigned
191             * short) value to be written.
192             *
193             * @exception IOException if an I/O error occurs.
194             *
195             * @see #writeShort(int)
196             */
197            void writeChar(int v) throws IOException;
198
199            /**
200             * Writes the 32 bits of <code>v</code> to the stream.  If the
201             * stream uses network byte order, the bytes written, in order,
202             * will be:
203             *
204             * <pre>
205             * (byte)((v &gt;&gt; 24) &amp; 0xff)
206             * (byte)((v &gt;&gt; 16) &amp; 0xff)
207             * (byte)((v &gt;&gt; 8) &amp; 0xff)
208             * (byte)(v &amp; 0xff)
209             * </pre>
210             *
211             * Otheriwse, the bytes written will be:
212             *
213             * <pre>
214             * (byte)(v &amp; 0xff)
215             * (byte)((v &gt;&gt; 8) &amp; 0xff)
216             * (byte)((v &gt;&gt; 16) &amp; 0xff)
217             * (byte)((v &gt;&gt; 24) &amp; 0xff)
218             * </pre>
219             *
220             * <p> If the bit offset within the stream is non-zero, the
221             * remainder of the current byte is padded with 0s
222             * and written out first.  The bit offset will be 0 after the
223             * write.
224             *
225             * @param v an <code>int</code> containing the value to be
226             * written.
227             *
228             * @exception IOException if an I/O error occurs.
229             */
230            void writeInt(int v) throws IOException;
231
232            /**
233             * Writes the 64 bits of <code>v</code> to the stream.  If the
234             * stream uses network byte order, the bytes written, in order,
235             * will be:
236             *
237             * <pre>
238             * (byte)((v &gt;&gt; 56) &amp; 0xff)
239             * (byte)((v &gt;&gt; 48) &amp; 0xff)
240             * (byte)((v &gt;&gt; 40) &amp; 0xff)
241             * (byte)((v &gt;&gt; 32) &amp; 0xff)
242             * (byte)((v &gt;&gt; 24) &amp; 0xff)
243             * (byte)((v &gt;&gt; 16) &amp; 0xff)
244             * (byte)((v &gt;&gt; 8) &amp; 0xff)
245             * (byte)(v &amp; 0xff)
246             * </pre>
247             *
248             * Otherwise, the bytes written will be:
249             *
250             * <pre>
251             * (byte)(v &amp; 0xff)
252             * (byte)((v &gt;&gt; 8) &amp; 0xff)
253             * (byte)((v &gt;&gt; 16) &amp; 0xff)
254             * (byte)((v &gt;&gt; 24) &amp; 0xff)
255             * (byte)((v &gt;&gt; 32) &amp; 0xff)
256             * (byte)((v &gt;&gt; 40) &amp; 0xff)
257             * (byte)((v &gt;&gt; 48) &amp; 0xff)
258             * (byte)((v &gt;&gt; 56) &amp; 0xff)
259             * </pre>
260             *
261             * <p> If the bit offset within the stream is non-zero, the
262             * remainder of the current byte is padded with 0s
263             * and written out first.  The bit offset will be 0 after the
264             * write.
265             *
266             * @param v a <code>long</code> containing the value to be
267             * written.
268             *
269             * @exception IOException if an I/O error occurs.
270             */
271            void writeLong(long v) throws IOException;
272
273            /**
274             * Writes a <code>float</code> value, which is comprised of four
275             * bytes, to the output stream. It does this as if it first
276             * converts this <code>float</code> value to an <code>int</code>
277             * in exactly the manner of the <code>Float.floatToIntBits</code>
278             * method and then writes the int value in exactly the manner of
279             * the <code>writeInt</code> method.
280             *
281             * <p> If the bit offset within the stream is non-zero, the
282             * remainder of the current byte is padded with 0s
283             * and written out first.  The bit offset will be 0 after the
284             * write.
285             *
286             * @param v a <code>float</code> containing the value to be
287             * written.
288             *
289             * @exception IOException if an I/O error occurs.
290             */
291            void writeFloat(float v) throws IOException;
292
293            /**
294             * Writes a <code>double</code> value, which is comprised of four
295             * bytes, to the output stream. It does this as if it first
296             * converts this <code>double</code> value to an <code>long</code>
297             * in exactly the manner of the
298             * <code>Double.doubleToLongBits</code> method and then writes the
299             * long value in exactly the manner of the <code>writeLong</code>
300             * method.
301             *
302             * <p> If the bit offset within the stream is non-zero, the
303             * remainder of the current byte is padded with 0s
304             * and written out first.  The bit offset will be 0 after the
305             * write.
306             *
307             * @param v a <code>double</code> containing the value to be
308             * written.
309             *
310             * @exception IOException if an I/O error occurs.
311             */
312            void writeDouble(double v) throws IOException;
313
314            /**
315             * Writes a string to the output stream. For every character in
316             * the string <code>s</code>, taken in order, one byte is written
317             * to the output stream. If <code>s</code> is <code>null</code>, a
318             * <code>NullPointerException</code> is thrown.
319             *
320             * <p> If <code>s.length</code> is zero, then no bytes are
321             * written. Otherwise, the character <code>s[0]</code> is written
322             * first, then <code>s[1]</code>, and so on; the last character
323             * written is <code>s[s.length-1]</code>. For each character, one
324             * byte is written, the low-order byte, in exactly the manner of
325             * the <code>writeByte</code> method. The high-order eight bits of
326             * each character in the string are ignored.
327             *
328             * <p> If the bit offset within the stream is non-zero, the
329             * remainder of the current byte is padded with 0s
330             * and written out first.  The bit offset will be 0 after the
331             * write.
332             *
333             * @param s a <code>String</code> containing the value to be
334             * written.
335             *
336             * @exception NullPointerException if <code>s</code> is
337             * <code>null</code>.
338             * @exception IOException if an I/O error occurs.
339             */
340            void writeBytes(String s) throws IOException;
341
342            /**
343             * Writes a string to the output stream. For every character in
344             * the string <code>s</code>, taken in order, two bytes are
345             * written to the output stream, ordered according to the current
346             * byte order setting.  If network byte order is being used, the
347             * high-order byte is written first; the order is reversed
348             * otherwise.  If <code>s</code> is <code>null</code>, a
349             * <code>NullPointerException</code> is thrown.
350             *
351             * <p> If <code>s.length</code> is zero, then no bytes are
352             * written. Otherwise, the character <code>s[0]</code> is written
353             * first, then <code>s[1]</code>, and so on; the last character
354             * written is <code>s[s.length-1]</code>.
355             *
356             * <p> If the bit offset within the stream is non-zero, the
357             * remainder of the current byte is padded with 0s
358             * and written out first.  The bit offset will be 0 after the
359             * write.
360             *
361             * @param s a <code>String</code> containing the value to be
362             * written.
363             *
364             * @exception NullPointerException if <code>s</code> is
365             * <code>null</code>.
366             * @exception IOException if an I/O error occurs.
367             */
368            void writeChars(String s) throws IOException;
369
370            /**
371             * Writes two bytes of length information to the output stream in
372             * network byte order, followed by the
373             * <a href="../../../java/io/DataInput.html#modified-utf-8">modified
374             * UTF-8</a>
375             * representation of every character in the string <code>s</code>.
376             * If <code>s</code> is <code>null</code>, a
377             * <code>NullPointerException</code> is thrown.  Each character in
378             * the string <code>s</code> is converted to a group of one, two,
379             * or three bytes, depending on the value of the character.
380             *
381             * <p> If a character <code>c</code> is in the range
382             * <code>&#92;u0001</code> through <code>&#92;u007f</code>, it is
383             * represented by one byte:
384             *
385             * <p><pre>
386             * (byte)c
387             * </pre>
388             *
389             * <p> If a character <code>c</code> is <code>&#92;u0000</code> or
390             * is in the range <code>&#92;u0080</code> through
391             * <code>&#92;u07ff</code>, then it is represented by two bytes,
392             * to be written in the order shown:
393             *
394             * <p> <pre><code>
395             * (byte)(0xc0 | (0x1f &amp; (c &gt;&gt; 6)))
396             * (byte)(0x80 | (0x3f &amp; c))
397             * </code></pre>
398             *
399             * <p> If a character <code>c</code> is in the range
400             * <code>&#92;u0800</code> through <code>uffff</code>, then it is
401             * represented by three bytes, to be written in the order shown:
402             *
403             * <p> <pre><code>
404             * (byte)(0xe0 | (0x0f &amp; (c &gt;&gt; 12)))
405             * (byte)(0x80 | (0x3f &amp; (c &gt;&gt; 6)))
406             * (byte)(0x80 | (0x3f &amp; c))
407             * </code></pre>
408             *
409             * <p> First, the total number of bytes needed to represent all
410             * the characters of <code>s</code> is calculated. If this number
411             * is larger than <code>65535</code>, then a
412             * <code>UTFDataFormatException</code> is thrown. Otherwise, this
413             * length is written to the output stream in exactly the manner of
414             * the <code>writeShort</code> method; after this, the one-, two-,
415             * or three-byte representation of each character in the string
416             * <code>s</code> is written.
417             *
418             * <p> The current byte order setting is ignored.
419             *
420             * <p> If the bit offset within the stream is non-zero, the
421             * remainder of the current byte is padded with 0s
422             * and written out first.  The bit offset will be 0 after the
423             * write.
424             *
425             * <p><strong>Note:</strong> This method should not be used in
426             * the  implementation of image formats that use standard UTF-8,
427             * because  the modified UTF-8 used here is incompatible with
428             * standard UTF-8.
429             *
430             * @param s a <code>String</code> containing the value to be
431             * written.
432             *
433             * @exception NullPointerException if <code>s</code> is
434             * <code>null</code>.
435             * @exception UTFDataFormatException if the modified UTF-8
436             * representation of <code>s</code> requires more than 65536 bytes.
437             * @exception IOException if an I/O error occurs.
438             */
439            void writeUTF(String s) throws IOException;
440
441            /**
442             * Writes a sequence of shorts to the stream at the current
443             * position.  If <code>len</code> is 0, nothing is written.
444             * The short <code>s[off]</code> is written first, then the short
445             * <code>s[off + 1]</code>, and so on.  The byte order of the
446             * stream is used to determine the order in which the individual
447             * bytes are written.
448             *
449             * <p> If the bit offset within the stream is non-zero, the
450             * remainder of the current byte is padded with 0s
451             * and written out first.  The bit offset will be 0 after the
452             * write.
453             *
454             * @param s an array of <code>short</code>s to be written.
455             * @param off the start offset in the data.
456             * @param len the number of <code>short</code>s to write.
457             *
458             * @exception IndexOutOfBoundsException if <code>off</code> is
459             * negative, <code>len</code> is negative, or <code>off +
460             * len</code> is greater than <code>s.length</code>.
461             * @exception NullPointerException if <code>s</code> is
462             * <code>null</code>.
463             * @exception IOException if an I/O error occurs.
464             */
465            void writeShorts(short[] s, int off, int len) throws IOException;
466
467            /**
468             * Writes a sequence of chars to the stream at the current
469             * position.  If <code>len</code> is 0, nothing is written.
470             * The char <code>c[off]</code> is written first, then the char
471             * <code>c[off + 1]</code>, and so on.  The byte order of the
472             * stream is used to determine the order in which the individual
473             * bytes are written.
474             *
475             * <p> If the bit offset within the stream is non-zero, the
476             * remainder of the current byte is padded with 0s
477             * and written out first.  The bit offset will be 0 after the
478             * write.
479             *
480             * @param c an array of <code>char</code>s to be written.
481             * @param off the start offset in the data.
482             * @param len the number of <code>char</code>s to write.
483             *
484             * @exception IndexOutOfBoundsException if <code>off</code> is
485             * negative, <code>len</code> is negative, or <code>off +
486             * len</code> is greater than <code>c.length</code>.
487             * @exception NullPointerException if <code>c</code> is
488             * <code>null</code>.
489             * @exception IOException if an I/O error occurs.
490             */
491            void writeChars(char[] c, int off, int len) throws IOException;
492
493            /**
494             * Writes a sequence of ints to the stream at the current
495             * position.  If <code>len</code> is 0, nothing is written.
496             * The int <code>i[off]</code> is written first, then the int
497             * <code>i[off + 1]</code>, and so on.  The byte order of the
498             * stream is used to determine the order in which the individual
499             * bytes are written.
500             *
501             * <p> If the bit offset within the stream is non-zero, the
502             * remainder of the current byte is padded with 0s
503             * and written out first.  The bit offset will be 0 after the
504             * write.
505             *
506             * @param i an array of <code>int</code>s to be written.
507             * @param off the start offset in the data.
508             * @param len the number of <code>int</code>s to write.
509             *
510             * @exception IndexOutOfBoundsException if <code>off</code> is
511             * negative, <code>len</code> is negative, or <code>off +
512             * len</code> is greater than <code>i.length</code>.
513             * @exception NullPointerException if <code>i</code> is
514             * <code>null</code>.
515             * @exception IOException if an I/O error occurs.
516             */
517            void writeInts(int[] i, int off, int len) throws IOException;
518
519            /**
520             * Writes a sequence of longs to the stream at the current
521             * position.  If <code>len</code> is 0, nothing is written.
522             * The long <code>l[off]</code> is written first, then the long
523             * <code>l[off + 1]</code>, and so on.  The byte order of the
524             * stream is used to determine the order in which the individual
525             * bytes are written.
526             *
527             * <p> If the bit offset within the stream is non-zero, the
528             * remainder of the current byte is padded with 0s
529             * and written out first.  The bit offset will be 0 after the
530             * write.
531             *
532             * @param l an array of <code>long</code>s to be written.
533             * @param off the start offset in the data.
534             * @param len the number of <code>long</code>s to write.
535             *
536             * @exception IndexOutOfBoundsException if <code>off</code> is
537             * negative, <code>len</code> is negative, or <code>off +
538             * len</code> is greater than <code>l.length</code>.
539             * @exception NullPointerException if <code>l</code> is
540             * <code>null</code>.
541             * @exception IOException if an I/O error occurs.
542             */
543            void writeLongs(long[] l, int off, int len) throws IOException;
544
545            /**
546             * Writes a sequence of floats to the stream at the current
547             * position.  If <code>len</code> is 0, nothing is written.
548             * The float <code>f[off]</code> is written first, then the float
549             * <code>f[off + 1]</code>, and so on.  The byte order of the
550             * stream is used to determine the order in which the individual
551             * bytes are written.
552             *
553             * <p> If the bit offset within the stream is non-zero, the
554             * remainder of the current byte is padded with 0s
555             * and written out first.  The bit offset will be 0 after the
556             * write.
557             *
558             * @param f an array of <code>float</code>s to be written.
559             * @param off the start offset in the data.
560             * @param len the number of <code>float</code>s to write.
561             *
562             * @exception IndexOutOfBoundsException if <code>off</code> is
563             * negative, <code>len</code> is negative, or <code>off +
564             * len</code> is greater than <code>f.length</code>.
565             * @exception NullPointerException if <code>f</code> is
566             * <code>null</code>.
567             * @exception IOException if an I/O error occurs.
568             */
569            void writeFloats(float[] f, int off, int len) throws IOException;
570
571            /**
572             * Writes a sequence of doubles to the stream at the current
573             * position.  If <code>len</code> is 0, nothing is written.
574             * The double <code>d[off]</code> is written first, then the double
575             * <code>d[off + 1]</code>, and so on.  The byte order of the
576             * stream is used to determine the order in which the individual
577             * bytes are written.
578             *
579             * <p> If the bit offset within the stream is non-zero, the
580             * remainder of the current byte is padded with 0s
581             * and written out first.  The bit offset will be 0 after the
582             * write.
583             *
584             * @param d an array of <code>doubles</code>s to be written.
585             * @param off the start offset in the data.
586             * @param len the number of <code>double</code>s to write.
587             *
588             * @exception IndexOutOfBoundsException if <code>off</code> is
589             * negative, <code>len</code> is negative, or <code>off +
590             * len</code> is greater than <code>d.length</code>.
591             * @exception NullPointerException if <code>d</code> is
592             * <code>null</code>.
593             * @exception IOException if an I/O error occurs.
594             */
595            void writeDoubles(double[] d, int off, int len) throws IOException;
596
597            /**
598             * Writes a single bit, given by the least significant bit of the
599             * argument, to the stream at the current bit offset within the
600             * current byte position.  The upper 31 bits of the argument are
601             * ignored.  The given bit replaces the previous bit at that
602             * position.  The bit offset is advanced by one and reduced modulo
603             * 8.
604             *
605             * <p> If any bits of a particular byte have never been set
606             * at the time the byte is flushed to the destination, those
607             * bits will be set to 0 automatically.
608             *
609             * @param bit an <code>int</code> whose least significant bit
610             * is to be written to the stream.
611             *
612             * @exception IOException if an I/O error occurs.
613             */
614            void writeBit(int bit) throws IOException;
615
616            /**
617             * Writes a sequence of bits, given by the <code>numBits</code>
618             * least significant bits of the <code>bits</code> argument in
619             * left-to-right order, to the stream at the current bit offset
620             * within the current byte position.  The upper <code>64 -
621             * numBits</code> bits of the argument are ignored.  The bit
622             * offset is advanced by <code>numBits</code> and reduced modulo
623             * 8.  Note that a bit offset of 0 always indicates the
624             * most-significant bit of the byte, and bytes of bits are written
625             * out in sequence as they are encountered.  Thus bit writes are
626             * always effectively in network byte order.  The actual stream
627             * byte order setting is ignored.
628             *
629             * <p> Bit data may be accumulated in memory indefinitely, until
630             * <code>flushBefore</code> is called.  At that time, all bit data
631             * prior to the flushed position will be written.
632             *
633             * <p> If any bits of a particular byte have never been set
634             * at the time the byte is flushed to the destination, those
635             * bits will be set to 0 automatically.
636             *
637             * @param bits a <code>long</code> containing the bits to be
638             * written, starting with the bit in position <code>numBits -
639             * 1</code> down to the least significant bit.
640             * 
641             * @param numBits an <code>int</code> between 0 and 64, inclusive.
642             *
643             * @exception IllegalArgumentException if <code>numBits</code> is
644             * not between 0 and 64, inclusive.
645             * @exception IOException if an I/O error occurs.
646             */
647            void writeBits(long bits, int numBits) throws IOException;
648
649            /**
650             * Flushes all data prior to the given position to the underlying
651             * destination, such as an <code>OutputStream</code> or
652             * <code>File</code>.  Attempting to seek to the flushed portion
653             * of the stream will result in an
654             * <code>IndexOutOfBoundsException</code>.
655             *
656             * @param pos a <code>long</code> containing the length of the
657             * stream prefix that may be flushed to the destination.
658             *
659             * @exception IndexOutOfBoundsException if <code>pos</code> lies
660             * in the flushed portion of the stream or past the current stream
661             * position.
662             * @exception IOException if an I/O error occurs.
663             */
664            void flushBefore(long pos) throws IOException;
665        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.