Source Code Cross Referenced for PDEmbeddedFile.java in  » PDF » PDFBox-0.7.3 » org » pdfbox » pdmodel » common » filespecification » 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 » PDF » PDFBox 0.7.3 » org.pdfbox.pdmodel.common.filespecification 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Copyright (c) 2004-2006, www.pdfbox.org
003:         * All rights reserved.
004:         *
005:         * Redistribution and use in source and binary forms, with or without
006:         * modification, are permitted provided that the following conditions are met:
007:         *
008:         * 1. Redistributions of source code must retain the above copyright notice,
009:         *    this list of conditions and the following disclaimer.
010:         * 2. Redistributions in binary form must reproduce the above copyright notice,
011:         *    this list of conditions and the following disclaimer in the documentation
012:         *    and/or other materials provided with the distribution.
013:         * 3. Neither the name of pdfbox; nor the names of its
014:         *    contributors may be used to endorse or promote products derived from this
015:         *    software without specific prior written permission.
016:         *
017:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
018:         * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
019:         * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
020:         * DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
021:         * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
022:         * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
023:         * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
024:         * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
025:         * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
026:         * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
027:         *
028:         * http://www.pdfbox.org
029:         *
030:         */package org.pdfbox.pdmodel.common.filespecification;
031:
032:        import java.io.IOException;
033:        import java.io.InputStream;
034:        import java.util.Calendar;
035:
036:        import org.pdfbox.cos.COSDictionary;
037:        import org.pdfbox.cos.COSStream;
038:        import org.pdfbox.pdmodel.PDDocument;
039:        import org.pdfbox.pdmodel.common.PDStream;
040:
041:        /**
042:         * This represents an embedded file in a file specification.
043:         *
044:         * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
045:         * @version $Revision: 1.2 $
046:         */
047:        public class PDEmbeddedFile extends PDStream {
048:
049:            /**
050:             * Constructor.
051:             * 
052:             * @param document {@inheritDoc}
053:             */
054:            public PDEmbeddedFile(PDDocument document) {
055:                super (document);
056:                getStream().setName("Type", "EmbeddedFile");
057:
058:            }
059:
060:            /**
061:             * Constructor.
062:             *
063:             * @param str The stream parameter.
064:             */
065:            public PDEmbeddedFile(COSStream str) {
066:                super (str);
067:            }
068:
069:            /**
070:             * Constructor.
071:             * 
072:             * @param doc {@inheritDoc}
073:             * @param str {@inheritDoc}
074:             * 
075:             * @throws IOException {@inheritDoc}
076:             */
077:            public PDEmbeddedFile(PDDocument doc, InputStream str)
078:                    throws IOException {
079:                super (doc, str);
080:                getStream().setName("Type", "EmbeddedFile");
081:            }
082:
083:            /**
084:             * Constructor.
085:             * 
086:             * @param doc {@inheritDoc}
087:             * @param str {@inheritDoc}
088:             * @param filtered {@inheritDoc}
089:             * 
090:             * @throws IOException {@inheritDoc}
091:             */
092:            public PDEmbeddedFile(PDDocument doc, InputStream str,
093:                    boolean filtered) throws IOException {
094:                super (doc, str, filtered);
095:                getStream().setName("Type", "EmbeddedFile");
096:            }
097:
098:            /**
099:             * Set the subtype for this embedded file.  This should be a mime type value.  Optional.
100:             * 
101:             * @param mimeType The mimeType for the file.
102:             */
103:            public void setSubtype(String mimeType) {
104:                getStream().setName("Subtype", mimeType);
105:            }
106:
107:            /**
108:             * Get the subtype(mimetype) for the embedded file.
109:             * 
110:             * @return The type of embedded file.
111:             */
112:            public String getSubtype() {
113:                return getStream().getNameAsString("Subtype");
114:            }
115:
116:            /**
117:             * Get the size of the embedded file.
118:             * 
119:             * @return The size of the embedded file.
120:             */
121:            public int getSize() {
122:                return getStream().getEmbeddedInt("Params", "Size");
123:            }
124:
125:            /**
126:             * Set the size of the embedded file.
127:             * 
128:             * @param size The size of the embedded file.
129:             */
130:            public void setSize(int size) {
131:                getStream().setEmbeddedInt("Params", "Size", size);
132:            }
133:
134:            /**
135:             * Get the creation date of the embedded file.
136:             * 
137:             * @return The Creation date.
138:             * @throws IOException If there is an error while constructing the date.
139:             */
140:            public Calendar getCreationDate() throws IOException {
141:                return getStream().getEmbeddedDate("Params", "CreationDate");
142:            }
143:
144:            /**
145:             * Set the creation date.
146:             * 
147:             * @param creation The new creation date.
148:             */
149:            public void setCreationDate(Calendar creation) {
150:                getStream().setEmbeddedDate("Params", "CreationDate", creation);
151:            }
152:
153:            /**
154:             * Get the mod date of the embedded file.
155:             * 
156:             * @return The mod date.
157:             * @throws IOException If there is an error while constructing the date.
158:             */
159:            public Calendar getModDate() throws IOException {
160:                return getStream().getEmbeddedDate("Params", "ModDate");
161:            }
162:
163:            /**
164:             * Set the mod date.
165:             * 
166:             * @param mod The new creation mod.
167:             */
168:            public void setModDate(Calendar mod) {
169:                getStream().setEmbeddedDate("Params", "ModDate", mod);
170:            }
171:
172:            /**
173:             * Get the check sum of the embedded file.
174:             * 
175:             * @return The check sum of the file.
176:             */
177:            public String getCheckSum() {
178:                return getStream().getEmbeddedString("Params", "CheckSum");
179:            }
180:
181:            /**
182:             * Set the check sum.
183:             * 
184:             * @param checksum The checksum of the file.
185:             */
186:            public void setCheckSum(String checksum) {
187:                getStream().setEmbeddedString("Params", "CheckSum", checksum);
188:            }
189:
190:            /**
191:             * Get the mac subtype.
192:             * 
193:             * @return The mac subtype.
194:             */
195:            public String getMacSubtype() {
196:                String retval = null;
197:                COSDictionary params = (COSDictionary) getStream()
198:                        .getDictionaryObject("Params");
199:                if (params != null) {
200:                    retval = params.getEmbeddedString("Mac", "Subtype");
201:                }
202:                return retval;
203:            }
204:
205:            /**
206:             * Set the mac subtype.
207:             * 
208:             * @param macSubtype The mac subtype.
209:             */
210:            public void setMacSubtype(String macSubtype) {
211:                COSDictionary params = (COSDictionary) getStream()
212:                        .getDictionaryObject("Params");
213:                if (params == null && macSubtype != null) {
214:                    params = new COSDictionary();
215:                    getStream().setItem("Params", params);
216:                }
217:                if (params != null) {
218:                    params.setEmbeddedString("Mac", "Subtype", macSubtype);
219:                }
220:            }
221:
222:            /**
223:             * Get the mac Creator.
224:             * 
225:             * @return The mac Creator.
226:             */
227:            public String getMacCreator() {
228:                String retval = null;
229:                COSDictionary params = (COSDictionary) getStream()
230:                        .getDictionaryObject("Params");
231:                if (params != null) {
232:                    retval = params.getEmbeddedString("Mac", "Creator");
233:                }
234:                return retval;
235:            }
236:
237:            /**
238:             * Set the mac Creator.
239:             * 
240:             * @param macCreator The mac Creator.
241:             */
242:            public void setMacCreator(String macCreator) {
243:                COSDictionary params = (COSDictionary) getStream()
244:                        .getDictionaryObject("Params");
245:                if (params == null && macCreator != null) {
246:                    params = new COSDictionary();
247:                    getStream().setItem("Params", params);
248:                }
249:                if (params != null) {
250:                    params.setEmbeddedString("Mac", "Creator", macCreator);
251:                }
252:            }
253:
254:            /**
255:             * Get the mac ResFork.
256:             * 
257:             * @return The mac ResFork.
258:             */
259:            public String getMacResFork() {
260:                String retval = null;
261:                COSDictionary params = (COSDictionary) getStream()
262:                        .getDictionaryObject("Params");
263:                if (params != null) {
264:                    retval = params.getEmbeddedString("Mac", "ResFork");
265:                }
266:                return retval;
267:            }
268:
269:            /**
270:             * Set the mac ResFork.
271:             * 
272:             * @param macResFork The mac ResFork.
273:             */
274:            public void setMacResFork(String macResFork) {
275:                COSDictionary params = (COSDictionary) getStream()
276:                        .getDictionaryObject("Params");
277:                if (params == null && macResFork != null) {
278:                    params = new COSDictionary();
279:                    getStream().setItem("Params", params);
280:                }
281:                if (params != null) {
282:                    params.setEmbeddedString("Mac", "ResFork", macResFork);
283:                }
284:            }
285:
286:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.