Source Code Cross Referenced for MAPIMessage.java in  » Collaboration » poi-3.0.2-beta2 » org » apache » poi » hsmf » 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 » Collaboration » poi 3.0.2 beta2 » org.apache.poi.hsmf 
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 org.apache.poi.hsmf;
019:
020:        import java.io.File;
021:        import java.io.FileInputStream;
022:        import java.io.IOException;
023:        import java.io.InputStream;
024:
025:        import org.apache.poi.hsmf.datatypes.Chunk;
026:        import org.apache.poi.hsmf.datatypes.Chunks;
027:        import org.apache.poi.hsmf.datatypes.StringChunk;
028:        import org.apache.poi.hsmf.exceptions.ChunkNotFoundException;
029:        import org.apache.poi.hsmf.parsers.POIFSChunkParser;
030:        import org.apache.poi.poifs.filesystem.POIFSFileSystem;
031:
032:        /**
033:         * Reads an Outlook MSG File in and provides hooks into its data structure.
034:         * 
035:         * @author Travis Ferguson
036:         */
037:        public class MAPIMessage {
038:            private POIFSChunkParser chunkParser;
039:            private POIFSFileSystem fs;
040:
041:            /**
042:             * Constructor for creating new files.
043:             *
044:             */
045:            public MAPIMessage() {
046:                //TODO make writing possible
047:            }
048:
049:            /**
050:             * Constructor for reading MSG Files from the file system.
051:             * @param filename
052:             * @throws IOException
053:             */
054:            public MAPIMessage(String filename) throws IOException {
055:                this (new FileInputStream(new File(filename)));
056:            }
057:
058:            /**
059:             * Constructor for reading MSG Files from an input stream.
060:             * @param in
061:             * @throws IOException
062:             */
063:            public MAPIMessage(InputStream in) throws IOException {
064:                this .fs = new POIFSFileSystem(in);
065:                chunkParser = new POIFSChunkParser(this .fs);
066:            }
067:
068:            /**
069:             * Gets a string value based on the passed chunk.
070:             * @param chunk
071:             * @return
072:             * @throws ChunkNotFoundException
073:             */
074:            public String getStringFromChunk(StringChunk chunk)
075:                    throws ChunkNotFoundException {
076:                Chunk out = this .chunkParser.getDocumentNode(chunk);
077:                StringChunk strchunk = (StringChunk) out;
078:                return strchunk.toString();
079:            }
080:
081:            /**
082:             * Gets the plain text body of this Outlook Message
083:             * @return The string representation of the 'text' version of the body, if available.
084:             * @throws IOException 
085:             * @throws ChunkNotFoundException 
086:             */
087:            public String getTextBody() throws IOException,
088:                    ChunkNotFoundException {
089:                return getStringFromChunk(Chunks.getInstance().textBodyChunk);
090:            }
091:
092:            /**
093:             * Gets the subject line of the Outlook Message
094:             * @return
095:             * @throws ChunkNotFoundException
096:             */
097:            public String getSubject() throws ChunkNotFoundException {
098:                return getStringFromChunk(Chunks.getInstance().subjectChunk);
099:            }
100:
101:            /**
102:             * Gets the display value of the "TO" line of the outlook message
103:             * This is not the actual list of addresses/values that will be sent to if you click Reply in the email.
104:             * @return
105:             * @throws ChunkNotFoundException
106:             */
107:            public String getDisplayTo() throws ChunkNotFoundException {
108:                return getStringFromChunk(Chunks.getInstance().displayToChunk);
109:            }
110:
111:            /**
112:             * Gets the display value of the "FROM" line of the outlook message
113:             * This is not the actual address that was sent from but the formated display of the user name.
114:             * @return
115:             * @throws ChunkNotFoundException
116:             */
117:            public String getDisplayFrom() throws ChunkNotFoundException {
118:                return getStringFromChunk(Chunks.getInstance().displayFromChunk);
119:            }
120:
121:            /**
122:             * Gets the display value of the "TO" line of the outlook message
123:             * This is not the actual list of addresses/values that will be sent to if you click Reply in the email.
124:             * @return
125:             * @throws ChunkNotFoundException
126:             */
127:            public String getDisplayCC() throws ChunkNotFoundException {
128:                return getStringFromChunk(Chunks.getInstance().displayCCChunk);
129:            }
130:
131:            /**
132:             * Gets the display value of the "TO" line of the outlook message
133:             * This is not the actual list of addresses/values that will be sent to if you click Reply in the email.
134:             * @return
135:             * @throws ChunkNotFoundException
136:             */
137:            public String getDisplayBCC() throws ChunkNotFoundException {
138:                return getStringFromChunk(Chunks.getInstance().displayBCCChunk);
139:            }
140:
141:            /**
142:             * Gets the conversation topic of the parsed Outlook Message.
143:             * This is the part of the subject line that is after the RE: and FWD:
144:             * @return
145:             * @throws ChunkNotFoundException
146:             */
147:            public String getConversationTopic() throws ChunkNotFoundException {
148:                return getStringFromChunk(Chunks.getInstance().conversationTopic);
149:            }
150:
151:            /**
152:             * Gets the message class of the parsed Outlook Message.
153:             * (Yes, you can use this to determine if a message is a calendar item, note, or actual outlook Message)
154:             * For emails the class will be IPM.Note
155:             * 
156:             * @return
157:             * @throws ChunkNotFoundException
158:             */
159:            public String getMessageClass() throws ChunkNotFoundException {
160:                return getStringFromChunk(Chunks.getInstance().messageClass);
161:            }
162:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.