Source Code Cross Referenced for PositionReader.java in  » Swing-Library » wings3 » org » wings » template » parser » 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 » Swing Library » wings3 » org.wings.template.parser 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 1997-1999 The Java Apache Project.  All rights reserved.
003:         *
004:         * Redistribution and use in source and binary forms, with or without
005:         * modification, are permitted provided that the following conditions
006:         * are met:
007:         *
008:         * 1. Redistributions of source code must retain the above copyright
009:         *    notice, this list of conditions and the following disclaimer.
010:         *
011:         * 2. Redistributions in binary form must reproduce the above copyright
012:         *    notice, this list of conditions and the following disclaimer in
013:         *    the documentation and/or other materials provided with the
014:         *    distribution.
015:         *
016:         * 3. All advertising materials mentioning features or use of this
017:         *    software must display the following acknowledgment:
018:         *    "This product includes software developed by the Java Apache 
019:         *    Project for use in the Apache JServ servlet engine project
020:         *    (http://java.apache.org/)."
021:         *
022:         * 4. The names "Apache JServ", "Apache JServ Servlet Engine" and 
023:         *    "Java Apache Project" must not be used to endorse or promote products 
024:         *    derived from this software without prior written permission.
025:         *
026:         * 5. Products derived from this software may not be called "Apache JServ"
027:         *    nor may "Apache" nor "Apache JServ" appear in their names without 
028:         *    prior written permission of the Java Apache Project.
029:         *
030:         * 6. Redistributions of any form whatsoever must retain the following
031:         *    acknowledgment:
032:         *    "This product includes software developed by the Java Apache 
033:         *    Project for use in the Apache JServ servlet engine project
034:         *    (http://java.apache.org/)."
035:         *    
036:         * THIS SOFTWARE IS PROVIDED BY THE JAVA APACHE PROJECT "AS IS" AND ANY
037:         * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
038:         * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
039:         * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE JAVA APACHE PROJECT OR
040:         * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
041:         * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
042:         * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
043:         * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
044:         * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
045:         * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
046:         * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
047:         * OF THE POSSIBILITY OF SUCH DAMAGE.
048:         *
049:         * This software consists of voluntary contributions made by many
050:         * individuals on behalf of the Java Apache Group. For more information
051:         * on the Java Apache Project and the Apache JServ Servlet Engine project,
052:         * please see <http://java.apache.org/>.
053:         */
054:
055:        /*
056:         * Copyright 2000,2005 wingS development team.
057:         *
058:         * This file is part of wingS (http://wingsframework.org).
059:         *
060:         * wingS is free software; you can redistribute it and/or modify
061:         * it under the terms of the GNU Lesser General Public License
062:         * as published by the Free Software Foundation; either version 2.1
063:         * of the License, or (at your option) any later version.
064:         *
065:         * Please see COPYING for the complete licence.
066:         */
067:        package org.wings.template.parser;
068:
069:        import java.io.IOException;
070:        import java.io.Reader;
071:
072:        /**
073:         * PositionReader can be asked for the
074:         * current position in the stream.
075:         *
076:         * @author <a href="mailto:zeller@think.de">Henner Zeller</a>
077:         */
078:        public class PositionReader extends Reader {
079:
080:            private Reader reader = null;
081:            private long position;
082:            private long savePosition = -1;
083:
084:            public PositionReader(Reader r) {
085:                this .reader = r;
086:                position = 0;
087:            }
088:
089:            /* ---- PositionReader ---- */
090:            public long getPosition() {
091:                return position;
092:            }
093:
094:            /* ---- Implementation of Reader ---- */
095:
096:            public int read() throws IOException {
097:                int c = reader.read();
098:                if (c != -1)
099:                    position++;
100:                return c;
101:            }
102:
103:            public int read(char cbuff[]) throws IOException {
104:                int num = reader.read(cbuff);
105:                if (num > 0)
106:                    position += num;
107:                return num;
108:            }
109:
110:            public int read(char cbuff[], int off, int len) throws IOException {
111:                int num = reader.read(cbuff, off, len);
112:                if (num > 0)
113:                    position += num;
114:                return num;
115:            }
116:
117:            public long skip(long n) throws IOException {
118:                long skipped = reader.skip(n);
119:                position += skipped;
120:                return skipped;
121:            }
122:
123:            public boolean ready() throws IOException {
124:                return reader.ready();
125:            }
126:
127:            public boolean markSupported() {
128:                return reader.markSupported();
129:            }
130:
131:            public void mark(int readAheadLimit) throws IOException {
132:                savePosition = position;
133:                reader.mark(readAheadLimit);
134:            }
135:
136:            public void reset() throws IOException {
137:                reader.reset();
138:                // this should be noticed by the reader before
139:                if (savePosition < 0)
140:                    throw new IOException("mark() not set before");
141:                position = savePosition;
142:            }
143:
144:            public void close() throws IOException {
145:                reader.close();
146:            }
147:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.