Source Code Cross Referenced for OutputStream.java in  » 6.0-JDK-Modules » j2me » java » io » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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 geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » java.io 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *   
003:         *
004:         * Copyright  1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006:         * 
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License version
009:         * 2 only, as published by the Free Software Foundation.
010:         * 
011:         * This program is distributed in the hope that it will be useful, but
012:         * WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014:         * General Public License version 2 for more details (a copy is
015:         * included at /legal/license.txt).
016:         * 
017:         * You should have received a copy of the GNU General Public License
018:         * version 2 along with this work; if not, write to the Free Software
019:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA
021:         * 
022:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023:         * Clara, CA 95054 or visit www.sun.com if you need additional
024:         * information or have any questions.
025:         */
026:
027:        package java.io;
028:
029:        /**
030:         * This abstract class is the superclass of all classes representing
031:         * an output stream of bytes. An output stream accepts output bytes
032:         * and sends them to some sink.
033:         * <p>
034:         * Applications that need to define a subclass of
035:         * <code>OutputStream</code> must always provide at least a method
036:         * that writes one byte of output.
037:         *
038:         * @version 12/17/01 (CLDC 1.1)
039:         * @see     java.io.ByteArrayOutputStream
040:         * @see     java.io.DataOutputStream
041:         * @see     java.io.InputStream
042:         * @see     java.io.OutputStream#write(int)
043:         * @since   JDK1.0, CLDC 1.0
044:         */
045:        public abstract class OutputStream {
046:
047:            /**
048:             * Writes the specified byte to this output stream. The general
049:             * contract for <code>write</code> is that one byte is written
050:             * to the output stream. The byte to be written is the eight
051:             * low-order bits of the argument <code>b</code>. The 24
052:             * high-order bits of <code>b</code> are ignored.
053:             * <p>
054:             * Subclasses of <code>OutputStream</code> must provide an
055:             * implementation for this method.
056:             *
057:             * @param      b   the <code>byte</code>.
058:             * @exception  IOException  if an I/O error occurs. In particular,
059:             *             an <code>IOException</code> may be thrown if the
060:             *             output stream has been closed.
061:             */
062:            public abstract void write(int b) throws IOException;
063:
064:            /**
065:             * Writes <code>b.length</code> bytes from the specified byte array
066:             * to this output stream. The general contract for <code>write(b)</code>
067:             * is that it should have exactly the same effect as the call
068:             * <code>write(b, 0, b.length)</code>.
069:             *
070:             * @param      b   the data.
071:             * @exception  IOException  if an I/O error occurs.
072:             * @see        java.io.OutputStream#write(byte[], int, int)
073:             */
074:            public void write(byte b[]) throws IOException {
075:                write(b, 0, b.length);
076:            }
077:
078:            /**
079:             * Writes <code>len</code> bytes from the specified byte array
080:             * starting at offset <code>off</code> to this output stream.
081:             * The general contract for <code>write(b, off, len)</code> is that
082:             * some of the bytes in the array <code>b</code> are written to the
083:             * output stream in order; element <code>b[off]</code> is the first
084:             * byte written and <code>b[off+len-1]</code> is the last byte written
085:             * by this operation.
086:             * <p>
087:             * The <code>write</code> method of <code>OutputStream</code> calls
088:             * the write method of one argument on each of the bytes to be
089:             * written out. Subclasses are encouraged to override this method and
090:             * provide a more efficient implementation.
091:             * <p>
092:             * If <code>b</code> is <code>null</code>, a
093:             * <code>NullPointerException</code> is thrown.
094:             * <p>
095:             * If <code>off</code> is negative, or <code>len</code> is negative, or
096:             * <code>off+len</code> is greater than the length of the array
097:             * <code>b</code>, then an <tt>IndexOutOfBoundsException</tt> is thrown.
098:             *
099:             * @param      b     the data.
100:             * @param      off   the start offset in the data.
101:             * @param      len   the number of bytes to write.
102:             * @exception  IOException  if an I/O error occurs. In particular,
103:             *             an <code>IOException</code> is thrown if the output
104:             *             stream is closed.
105:             */
106:            public void write(byte b[], int off, int len) throws IOException {
107:                if (b == null) {
108:                    throw new NullPointerException();
109:                } else if ((off < 0) || (off > b.length) || (len < 0)
110:                        || ((off + len) > b.length) || ((off + len) < 0)) {
111:                    throw new IndexOutOfBoundsException();
112:                } else if (len == 0) {
113:                    return;
114:                }
115:                for (int i = 0; i < len; i++) {
116:                    write(b[off + i]);
117:                }
118:            }
119:
120:            /**
121:             * Flushes this output stream and forces any buffered output bytes
122:             * to be written out. The general contract of <code>flush</code> is
123:             * that calling it is an indication that, if any bytes previously
124:             * written have been buffered by the implementation of the output
125:             * stream, such bytes should immediately be written to their
126:             * intended destination.
127:             * <p>
128:             * The <code>flush</code> method of <code>OutputStream</code> does nothing.
129:             *
130:             * @exception  IOException  if an I/O error occurs.
131:             */
132:            public void flush() throws IOException {
133:            }
134:
135:            /**
136:             * Closes this output stream and releases any system resources
137:             * associated with this stream. The general contract of <code>close</code>
138:             * is that it closes the output stream. A closed stream cannot perform
139:             * output operations and cannot be reopened.
140:             * <p>
141:             * The <code>close</code> method of <code>OutputStream</code> does nothing.
142:             *
143:             * @exception  IOException  if an I/O error occurs.
144:             */
145:            public void close() throws IOException {
146:            }
147:
148:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.