Source Code Cross Referenced for MozillaImporter.java in  » Mail-Clients » columba-1.4 » org » columba » mail » folder » mailboximport » 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 » Mail Clients » columba 1.4 » org.columba.mail.folder.mailboximport 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // The contents of this file are subject to the Mozilla Public License Version
002:        // 1.1
003:        //(the "License"); you may not use this file except in compliance with the
004:        //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
005:        //
006:        //Software distributed under the License is distributed on an "AS IS" basis,
007:        //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
008:        //for the specific language governing rights and
009:        //limitations under the License.
010:        //
011:        //The Original Code is "The Columba Project"
012:        //
013:        //The Initial Developers of the Original Code are Frederik Dietz and Timo
014:        // Stich.
015:        //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
016:        //
017:        //All Rights Reserved.
018:
019:        package org.columba.mail.folder.mailboximport;
020:
021:        import java.io.BufferedReader;
022:        import java.io.File;
023:        import java.io.FileReader;
024:
025:        import org.columba.api.command.IWorkerStatusController;
026:        import org.columba.mail.folder.IMailbox;
027:        import org.columba.mail.util.MailResourceLoader;
028:
029:        /**
030:         * @version 1.0
031:         * @author
032:         */
033:        public class MozillaImporter extends AbstractMailboxImporter {
034:            public MozillaImporter() {
035:                super ();
036:            }
037:
038:            public MozillaImporter(IMailbox destinationFolder,
039:                    File[] sourceFiles) {
040:                super (destinationFolder, sourceFiles);
041:            }
042:
043:            public int getType() {
044:                return TYPE_FILE;
045:            }
046:
047:            public void importMailboxFile(File file,
048:                    IWorkerStatusController worker, IMailbox destFolder)
049:                    throws Exception {
050:                int count = 0;
051:                boolean sucess = false;
052:
053:                StringBuffer strbuf = new StringBuffer();
054:
055:                BufferedReader in = new BufferedReader(new FileReader(file));
056:                String str;
057:
058:                // parse line by line
059:                while ((str = in.readLine()) != null) {
060:                    // if user cancelled task exit immediately
061:                    if (worker.cancelled()) {
062:                        return;
063:                    }
064:
065:                    // if line doesn't start with "From" or line length is 0
066:                    //  -> save everything in StringBuffer
067:                    if (!str.startsWith("From ") || str.length() == 0) {
068:                        strbuf.append(str + "\n");
069:                    } else {
070:                        // line contains "-" (mozilla mbox style)
071:                        //  -> import message in Columba
072:                        if (str.indexOf("-") != -1) {
073:                            if (strbuf.length() != 0) {
074:                                // found new message
075:                                saveMessage(strbuf.toString(), worker,
076:                                        getDestinationFolder());
077:
078:                                count++;
079:
080:                                sucess = true;
081:                            }
082:
083:                            strbuf = new StringBuffer();
084:                        } else {
085:                            strbuf.append(str + "\n");
086:                        }
087:                    }
088:                }
089:
090:                // save last message, because while loop aborted before being able to
091:                // save message
092:                if (sucess && strbuf.length() > 0) {
093:                    saveMessage(strbuf.toString(), worker,
094:                            getDestinationFolder());
095:                }
096:
097:                in.close();
098:            }
099:
100:            public String getDescription() {
101:                return MailResourceLoader.getString("dialog", "mailboximport",
102:                        "Mozilla_description");
103:            }
104:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.