Source Code Cross Referenced for OutputStream.java in  » Apache-Harmony-Java-SE » java-package » 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 » Apache Harmony Java SE » java package » java.io 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         */
017:
018:        package java.io;
019:
020:        import org.apache.harmony.luni.util.Msg;
021:
022:        /**
023:         * OutputStream is an abstract class for all byte output streams. It provides
024:         * basic method implementations for writing bytes to a stream.
025:         * 
026:         * @see InputStream
027:         */
028:        public abstract class OutputStream implements  Closeable, Flushable {
029:
030:            /**
031:             * Default constructor.
032:             */
033:            public OutputStream() {
034:                super ();
035:            }
036:
037:            /**
038:             * Close this OutputStream. Concrete implementations of this class should
039:             * free any resources during close. This implementation does nothing.
040:             * 
041:             * @throws IOException
042:             *             If an error occurs attempting to close this OutputStream.
043:             */
044:            public void close() throws IOException {
045:                /* empty */
046:            }
047:
048:            /**
049:             * Flush this OutputStream. Concrete implementations of this class should
050:             * ensure any pending writes to the underlying stream are written out when
051:             * this method is envoked. This implementation does nothing.
052:             * 
053:             * @throws IOException
054:             *             If an error occurs attempting to flush this OutputStream.
055:             */
056:            public void flush() throws IOException {
057:                /* empty */
058:            }
059:
060:            /**
061:             * Writes the entire contents of the byte array <code>buffer</code> to
062:             * this OutputStream.
063:             * 
064:             * @param buffer
065:             *            the buffer to be written
066:             * 
067:             * @throws IOException
068:             *             If an error occurs attempting to write to this OutputStream.
069:             */
070:            public void write(byte buffer[]) throws IOException {
071:                write(buffer, 0, buffer.length);
072:            }
073:
074:            /**
075:             * Writes <code>count</code> <code>bytes</code> from the byte array
076:             * <code>buffer</code> starting at <code>offset</code> to this
077:             * OutputStream.
078:             * 
079:             * @param buffer
080:             *            the buffer to be written
081:             * @param offset
082:             *            offset in buffer to get bytes
083:             * @param count
084:             *            number of bytes in buffer to write
085:             * 
086:             * @throws IOException
087:             *             If an error occurs attempting to write to this OutputStream.
088:             * @throws IndexOutOfBoundsException
089:             *             If offset or count are outside of bounds.
090:             */
091:            public void write(byte buffer[], int offset, int count)
092:                    throws IOException {
093:                // avoid int overflow, check null buffer
094:                if (offset > buffer.length || offset < 0 || count < 0
095:                        || count > buffer.length - offset) {
096:                    throw new IndexOutOfBoundsException(Msg.getString("K002f")); //$NON-NLS-1$
097:                }
098:                for (int i = offset; i < offset + count; i++) {
099:                    write(buffer[i]);
100:                }
101:            }
102:
103:            /**
104:             * Writes the specified byte <code>oneByte</code> to this OutputStream.
105:             * Only the low order byte of <code>oneByte</code> is written.
106:             * 
107:             * @param oneByte
108:             *            the byte to be written
109:             * 
110:             * @throws IOException
111:             *             If an error occurs attempting to write to this OutputStream.
112:             */
113:            public abstract void write(int oneByte) throws IOException;
114:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.