Source Code Cross Referenced for BufferFactory.java in  » Apache-Harmony-Java-SE » java-package » java » nio » 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.nio 
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.nio;
019:
020:        /**
021:         * Provide factory service of buffer classes.
022:         * <p>
023:         * Since all buffer impl classes are package private (except DirectByteBuffer),
024:         * this factory is the only entrance to access buffer functions from outside of
025:         * the impl package.
026:         * </p>
027:         */
028:        final class BufferFactory {
029:
030:            /**
031:             * Returns a new byte buffer based on the specified byte array.
032:             * 
033:             * @param array
034:             *            The byte array
035:             * @return A new byte buffer based on the specified byte array.
036:             */
037:            public static ByteBuffer newByteBuffer(byte array[]) {
038:                return new ReadWriteHeapByteBuffer(array);
039:            }
040:
041:            /**
042:             * Returns a new array based byte buffer with the specified capacity.
043:             * 
044:             * @param capacity
045:             *            The capacity of the new buffer
046:             * @return A new array based byte buffer with the specified capacity.
047:             */
048:            public static ByteBuffer newByteBuffer(int capacity) {
049:                return new ReadWriteHeapByteBuffer(capacity);
050:            }
051:
052:            /**
053:             * Returns a new char buffer based on the specified char array.
054:             * 
055:             * @param array
056:             *            The char array
057:             * @return A new char buffer based on the specified char array.
058:             */
059:            public static CharBuffer newCharBuffer(char array[]) {
060:                return new ReadWriteCharArrayBuffer(array);
061:            }
062:
063:            /**
064:             * Returns a new readonly char buffer based on the specified char sequence.
065:             * 
066:             * @param chseq
067:             *            The char sequence
068:             * @return A new readonly char buffer based on the specified char sequence.
069:             */
070:            public static CharBuffer newCharBuffer(CharSequence chseq) {
071:                return new CharSequenceAdapter(chseq);
072:            }
073:
074:            /**
075:             * Returns a new array based char buffer with the specified capacity.
076:             * 
077:             * @param capacity
078:             *            The capacity of the new buffer
079:             * @return A new array based char buffer with the specified capacity.
080:             */
081:            public static CharBuffer newCharBuffer(int capacity) {
082:                return new ReadWriteCharArrayBuffer(capacity);
083:            }
084:
085:            /**
086:             * Returns a new direct byte buffer with the specified capacity.
087:             * 
088:             * @param capacity
089:             *            The capacity of the new buffer
090:             * @return A new direct byte buffer with the specified capacity.
091:             */
092:            public static ByteBuffer newDirectByteBuffer(int capacity) {
093:                return new ReadWriteDirectByteBuffer(capacity);
094:            }
095:
096:            /**
097:             * Returns a new double buffer based on the specified double array.
098:             * 
099:             * @param array
100:             *            The double array
101:             * @return A new double buffer based on the specified double array.
102:             */
103:            public static DoubleBuffer newDoubleBuffer(double array[]) {
104:                return new ReadWriteDoubleArrayBuffer(array);
105:            }
106:
107:            /**
108:             * Returns a new array based double buffer with the specified capacity.
109:             * 
110:             * @param capacity
111:             *            The capacity of the new buffer
112:             * @return A new array based double buffer with the specified capacity.
113:             */
114:            public static DoubleBuffer newDoubleBuffer(int capacity) {
115:                return new ReadWriteDoubleArrayBuffer(capacity);
116:            }
117:
118:            /**
119:             * Returns a new float buffer based on the specified float array.
120:             * 
121:             * @param array
122:             *            The float array
123:             * @return A new float buffer based on the specified float array.
124:             */
125:            public static FloatBuffer newFloatBuffer(float array[]) {
126:                return new ReadWriteFloatArrayBuffer(array);
127:            }
128:
129:            /**
130:             * Returns a new array based float buffer with the specified capacity.
131:             * 
132:             * @param capacity
133:             *            The capacity of the new buffer
134:             * @return A new array based float buffer with the specified capacity.
135:             */
136:            public static FloatBuffer newFloatBuffer(int capacity) {
137:                return new ReadWriteFloatArrayBuffer(capacity);
138:            }
139:
140:            /**
141:             * Returns a new array based int buffer with the specified capacity.
142:             * 
143:             * @param capacity
144:             *            The capacity of the new buffer
145:             * @return A new array based int buffer with the specified capacity.
146:             */
147:            public static IntBuffer newIntBuffer(int capacity) {
148:                return new ReadWriteIntArrayBuffer(capacity);
149:            }
150:
151:            /**
152:             * Returns a new int buffer based on the specified int array.
153:             * 
154:             * @param array
155:             *            The int array
156:             * @return A new int buffer based on the specified int array.
157:             */
158:            public static IntBuffer newIntBuffer(int array[]) {
159:                return new ReadWriteIntArrayBuffer(array);
160:            }
161:
162:            /**
163:             * Returns a new array based long buffer with the specified capacity.
164:             * 
165:             * @param capacity
166:             *            The capacity of the new buffer
167:             * @return A new array based long buffer with the specified capacity.
168:             */
169:            public static LongBuffer newLongBuffer(int capacity) {
170:                return new ReadWriteLongArrayBuffer(capacity);
171:            }
172:
173:            /**
174:             * Returns a new long buffer based on the specified long array.
175:             * 
176:             * @param array
177:             *            The long array
178:             * @return A new long buffer based on the specified long array.
179:             */
180:            public static LongBuffer newLongBuffer(long array[]) {
181:                return new ReadWriteLongArrayBuffer(array);
182:            }
183:
184:            /**
185:             * Returns a new array based short buffer with the specified capacity.
186:             * 
187:             * @param capacity
188:             *            The capacity of the new buffer
189:             * @return A new array based short buffer with the specified capacity.
190:             */
191:            public static ShortBuffer newShortBuffer(int capacity) {
192:                return new ReadWriteShortArrayBuffer(capacity);
193:            }
194:
195:            /**
196:             * Returns a new short buffer based on the specified short array.
197:             * 
198:             * @param array
199:             *            The short array
200:             * @return A new short buffer based on the specified short array.
201:             */
202:            public static ShortBuffer newShortBuffer(short array[]) {
203:                return new ReadWriteShortArrayBuffer(array);
204:            }
205:
206:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.