Source Code Cross Referenced for StreamImpl.java in  » EJB-Server-resin-3.1.5 » util » com » caucho » vfs » 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 » EJB Server resin 3.1.5 » util » com.caucho.vfs 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003:         *
004:         * This file is part of Resin(R) Open Source
005:         *
006:         * Each copy or derived work must preserve the copyright notice and this
007:         * notice unmodified.
008:         *
009:         * Resin Open Source is free software; you can redistribute it and/or modify
010:         * it under the terms of the GNU General Public License as published by
011:         * the Free Software Foundation; either version 2 of the License, or
012:         * (at your option) any later version.
013:         *
014:         * Resin Open Source is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017:         * of NON-INFRINGEMENT.  See the GNU General Public License for more
018:         * details.
019:         *
020:         * You should have received a copy of the GNU General Public License
021:         * along with Resin Open Source; if not, write to the
022:         *
023:         *   Free Software Foundation, Inc.
024:         *   59 Temple Place, Suite 330
025:         *   Boston, MA 02111-1307  USA
026:         *
027:         * @author Scott Ferguson
028:         */
029:
030:        package com.caucho.vfs;
031:
032:        import com.caucho.util.NullIterator;
033:
034:        import java.io.IOException;
035:        import java.util.Iterator;
036:
037:        /**
038:         * This is the service provider's interface for a stream supported by
039:         * the VFS.
040:         */
041:        public class StreamImpl {
042:            protected static NullPath _nullPath;
043:
044:            private static final byte _newline[] = new byte[] { (byte) '\n' };
045:
046:            protected Path _path;
047:
048:            /**
049:             * Returns the stream's natural newline character.
050:             */
051:            public byte[] getNewline() {
052:                return _newline;
053:            }
054:
055:            /**
056:             * Returns true if the stream implements skip.
057:             */
058:            public boolean hasSkip() {
059:                return false;
060:            }
061:
062:            /**
063:             * Skips a number of bytes, returning the bytes skipped.
064:             *
065:             * @param n the number of types to skip.
066:             *
067:             * @return the actual bytes skipped.
068:             */
069:            public long skip(long n) throws IOException {
070:                return 0;
071:            }
072:
073:            /**
074:             * Returns true if this is a read stream.
075:             */
076:            public boolean canRead() {
077:                return false;
078:            }
079:
080:            /**
081:             * Returns the read buffer.
082:             */
083:            public byte[] getReadBuffer() {
084:                return null;
085:            }
086:
087:            /**
088:             * Reads the next chunk from the stream.
089:             *
090:             * @param buffer byte array receiving the data.
091:             * @param offset starting offset into the array.
092:             * @param length number of bytes to read.
093:             *
094:             * @return the number of bytes read or -1 on end of file.
095:             */
096:            public int read(byte[] buffer, int offset, int length)
097:                    throws IOException {
098:                throw new UnsupportedOperationException(String.valueOf(this ));
099:            }
100:
101:            /**
102:             * Reads the next chunk from the stream in non-blocking mode.
103:             *
104:             * @param buffer byte array receiving the data.
105:             * @param offset starting offset into the array.
106:             * @param length number of bytes to read.
107:             *
108:             * @return the number of bytes read or -1 on end of file.
109:             */
110:            public int readNonBlock(byte[] buffer, int offset, int length)
111:                    throws IOException {
112:                return 0;
113:            }
114:
115:            /**
116:             * Reads the next chunk from the stream in non-blocking mode.
117:             *
118:             * @param buffer byte array receiving the data.
119:             * @param offset starting offset into the array.
120:             * @param length number of bytes to read.
121:             *
122:             * @return the number of bytes read or -1 on end of file.
123:             */
124:            public int readTimeout(byte[] buffer, int offset, int length,
125:                    long timeout) throws IOException {
126:                return 0;
127:            }
128:
129:            /**
130:             * Returns the number of bytes available without blocking.  Depending on
131:             * the stream, this may return less than the actual bytes, but will always
132:             * return a number > 0 if there is any data available.
133:             */
134:            public int getAvailable() throws IOException {
135:                throw new UnsupportedOperationException(String.valueOf(this ));
136:            }
137:
138:            /**
139:             * Returns the current read position of the underlying file.
140:             */
141:            public long getReadPosition() {
142:                return -1;
143:            }
144:
145:            /**
146:             * Returns true if this is a writable stream.
147:             */
148:            public boolean canWrite() {
149:                return false;
150:            }
151:
152:            /**
153:             * Returns true if the buffer should be flushed on every newline.  This is
154:             * typically only true for error streams like stderr:.
155:             */
156:            public boolean getFlushOnNewline() {
157:                return false;
158:            }
159:
160:            /**
161:             * Sets the write encoding.
162:             */
163:            public void setWriteEncoding(String encoding) {
164:            }
165:
166:            /**
167:             * Writes a buffer to the underlying stream.
168:             *
169:             * @param buffer the byte array to write.
170:             * @param offset the offset into the byte array.
171:             * @param length the number of bytes to write.
172:             * @param isEnd true when the write is flushing a close.
173:             */
174:            public void write(byte[] buffer, int offset, int length,
175:                    boolean isEnd) throws IOException {
176:                throw new UnsupportedOperationException(String.valueOf(this ));
177:            }
178:
179:            /**
180:             * Writes a pair of buffer to the underlying stream.
181:             *
182:             * @param buf1 the byte array to write.
183:             * @param off1 the offset into the byte array.
184:             * @param len1 the number of bytes to write.
185:             * @param buf2 the byte array to write.
186:             * @param off2 the offset into the byte array.
187:             * @param len2 the number of bytes to write.
188:             * @param isEnd true when the write is flushing a close.
189:             */
190:            public boolean write(byte[] buf1, int off1, int len1, byte[] buf2,
191:                    int off2, int len2, boolean isEnd) throws IOException {
192:                if (len1 == 0) {
193:                    write(buf2, off2, len2, isEnd);
194:
195:                    return true;
196:                } else
197:                    return false;
198:            }
199:
200:            /**
201:             * Clears any buffered values in the write.
202:             */
203:            public void clearWrite() {
204:            }
205:
206:            /**
207:             * Seeks based on the start.
208:             */
209:            public void seekStart(long offset) throws IOException {
210:                throw new UnsupportedOperationException(getClass().getName());
211:            }
212:
213:            /**
214:             * Seeks based on the end.
215:             */
216:            public void seekEnd(long offset) throws IOException {
217:                throw new UnsupportedOperationException(getClass().getName());
218:            }
219:
220:            /**
221:             * Flushes buffered writes.
222:             */
223:            public void flushBuffer() throws IOException {
224:            }
225:
226:            /**
227:             * Flushes the write output.
228:             */
229:            public void flush() throws IOException {
230:            }
231:
232:            /**
233:             * Flushes the write output, forcing to disk.
234:             */
235:            public void flushToDisk() throws IOException {
236:                throw new UnsupportedOperationException();
237:            }
238:
239:            /**
240:             * Returns the Path associated with the stream.
241:             */
242:            public Path getPath() {
243:                if (_path != null)
244:                    return _path;
245:
246:                if (_nullPath == null)
247:                    _nullPath = new NullPath("stream");
248:
249:                return _nullPath;
250:            }
251:
252:            /**
253:             * Sets the Path associated with the stream.
254:             */
255:            public void setPath(Path path) {
256:                _path = path;
257:            }
258:
259:            /**
260:             * Returns a stream attribute.
261:             *
262:             * @param name the attribute name.
263:             *
264:             * @return the attribute value.
265:             */
266:            public Object getAttribute(String name) throws IOException {
267:                return null;
268:            }
269:
270:            /**
271:             * Sets a stream attribute.
272:             *
273:             * @param name the attribute name.
274:             * @param value the attribute value.
275:             */
276:            public void setAttribute(String name, Object value)
277:                    throws IOException {
278:            }
279:
280:            /**
281:             * Removes a stream attribute.
282:             *
283:             * @param name the attribute name.
284:             */
285:            public void removeAttribute(String name) throws IOException {
286:            }
287:
288:            /**
289:             * Returns an iterator of the attribute names.
290:             */
291:            public Iterator getAttributeNames() throws IOException {
292:                return NullIterator.create();
293:            }
294:
295:            /**
296:             * Closes the write half of the stream.
297:             */
298:            public void closeWrite() throws IOException {
299:                close();
300:            }
301:
302:            /**
303:             * Closes the stream.
304:             */
305:            public void close() throws IOException {
306:            }
307:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.