Source Code Cross Referenced for OutputFiller.java in  » Content-Management-System » openedit » com » openedit » util » 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 » Content Management System » openedit » com.openedit.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.openedit.util;
002:
003:        import java.io.File;
004:        import java.io.FileInputStream;
005:        import java.io.FileOutputStream;
006:        import java.io.IOException;
007:        import java.io.InputStream;
008:        import java.io.OutputStream;
009:
010:        /**
011:         * Creation date: (9/11/2001 4:43:00 PM)
012:         * @author: CSB
013:         */
014:        public class OutputFiller {
015:            protected int fieldBufferSize = 1024;
016:
017:            /**
018:             * InputFlusher constructor comment.
019:             */
020:            public OutputFiller() {
021:                super ();
022:            }
023:
024:            /**
025:             * Creation date: (9/11/2001 4:55:34 PM)
026:             * @param inBufferSize int
027:             */
028:            public OutputFiller(int inBufferSize) {
029:                setBufferSize(inBufferSize);
030:            }
031:
032:            public void fill(java.io.InputStream in, java.io.OutputStream out)
033:                    throws java.io.IOException {
034:                byte[] bytes = new byte[getBufferSize()];
035:
036:                int iRead = -1;
037:
038:                while (true) {
039:                    iRead = in.read(bytes);
040:
041:                    if (iRead != -1) {
042:                        out.write(bytes, 0, iRead);
043:                    } else {
044:                        break;
045:                    }
046:                }
047:                out.flush();
048:            }
049:
050:            public void fill(java.io.Reader in, java.io.Writer out)
051:                    throws java.io.IOException {
052:                char[] bytes = new char[getBufferSize()];
053:
054:                int iRead = -1;
055:
056:                while (true) {
057:                    iRead = in.read(bytes);
058:
059:                    if (iRead != -1) {
060:                        out.write(bytes, 0, iRead);
061:                    } else {
062:                        break;
063:                    }
064:
065:                }
066:                out.flush();
067:            }
068:
069:            public void fill(File inSource, File inOut) throws IOException {
070:                FileInputStream in = null;
071:                try {
072:                    in = new FileInputStream(inSource);
073:                    inOut.getParentFile().mkdirs();
074:                    FileOutputStream out = new FileOutputStream(inOut);
075:                    try {
076:                        fill(in, out);
077:                    } finally {
078:                        FileUtils.safeClose(out);
079:                    }
080:                } finally {
081:                    FileUtils.safeClose(in);
082:                }
083:            }
084:
085:            /**
086:             * Creation date: (9/11/2001 4:53:38 PM)
087:             * @return int
088:             */
089:            public int getBufferSize() {
090:                return fieldBufferSize;
091:            }
092:
093:            /**
094:             * Creation date: (9/11/2001 4:53:38 PM)
095:             * @param newBufferSize int
096:             */
097:            public void setBufferSize(int newBufferSize) {
098:                fieldBufferSize = newBufferSize;
099:            }
100:
101:            /**
102:             * @param inIn
103:             */
104:            public void close(InputStream inIn) {
105:                if (inIn != null) {
106:                    try {
107:                        inIn.close();
108:                    } catch (IOException ex) {
109:                        //fail silently
110:                    }
111:                }
112:            }
113:
114:            public void close(OutputStream inIn) {
115:                if (inIn != null) {
116:                    try {
117:                        inIn.close();
118:                    } catch (IOException ex) {
119:                        //fail silently
120:                    }
121:                }
122:            }
123:
124:            public void fill(InputStream inIn, File inOutput)
125:                    throws IOException {
126:                inOutput.getParentFile().mkdirs();
127:                FileOutputStream out = new FileOutputStream(inOutput);
128:                try {
129:                    fill(inIn, out);
130:                } finally {
131:                    close(out);
132:                }
133:            }
134:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.