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


001:        /**
002:         * Copyright (c) 2005, 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;
031:
032:        import java.io.ByteArrayInputStream;
033:        import java.io.IOException;
034:        import java.io.InputStream;
035:        import java.io.OutputStream;
036:
037:        import java.util.List;
038:
039:        import org.pdfbox.cos.COSBase;
040:        import org.pdfbox.cos.COSStream;
041:
042:        import org.pdfbox.pdmodel.common.filespecification.PDFileSpecification;
043:
044:        /**
045:         * A PDStream represents a stream in a PDF document.  Streams are tied to a single
046:         * PDF document.
047:         *
048:         * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
049:         * @version $Revision: 1.2 $
050:         */
051:        public class PDMemoryStream extends PDStream {
052:            private byte[] data;
053:
054:            /**
055:             * This will create a new PDStream object.
056:             * 
057:             * @param buffer The data for this in memory stream.
058:             */
059:            public PDMemoryStream(byte[] buffer) {
060:                data = buffer;
061:            }
062:
063:            /**
064:             * If there are not compression filters on the current stream then this
065:             * will add a compression filter, flate compression for example.
066:             */
067:            public void addCompression() {
068:                //no compression to add
069:            }
070:
071:            /**
072:             * Convert this standard java object to a COS object.
073:             *
074:             * @return The cos object that matches this Java object.
075:             */
076:            public COSBase getCOSObject() {
077:                throw new UnsupportedOperationException(
078:                        "not supported for memory stream");
079:            }
080:
081:            /**
082:             * This will get a stream that can be written to.
083:             * 
084:             * @return An output stream to write data to.
085:             * 
086:             * @throws IOException If an IO error occurs during writing.
087:             */
088:            public OutputStream createOutputStream() throws IOException {
089:                throw new UnsupportedOperationException(
090:                        "not supported for memory stream");
091:            }
092:
093:            /**
094:             * This will get a stream that can be read from.
095:             * 
096:             * @return An input stream that can be read from.
097:             * 
098:             * @throws IOException If an IO error occurs during reading.
099:             */
100:            public InputStream createInputStream() throws IOException {
101:                return new ByteArrayInputStream(data);
102:            }
103:
104:            /**
105:             * This will get a stream with some filters applied but not others.  This is useful
106:             * when doing images, ie filters = [flate,dct], we want to remove flate but leave dct
107:             * 
108:             * @param stopFilters A list of filters to stop decoding at.
109:             * @return A stream with decoded data.
110:             * @throws IOException If there is an error processing the stream.
111:             */
112:            public InputStream getPartiallyFilteredStream(List stopFilters)
113:                    throws IOException {
114:                return createInputStream();
115:            }
116:
117:            /**
118:             * Get the cos stream associated with this object.
119:             *
120:             * @return The cos object that matches this Java object.
121:             */
122:            public COSStream getStream() {
123:                throw new UnsupportedOperationException(
124:                        "not supported for memory stream");
125:            }
126:
127:            /**
128:             * This will get the length of the filtered/compressed stream.  This is readonly in the 
129:             * PD Model and will be managed by this class.
130:             * 
131:             * @return The length of the filtered stream.
132:             */
133:            public int getLength() {
134:                return data.length;
135:            }
136:
137:            /**
138:             * This will get the list of filters that are associated with this stream.  Or
139:             * null if there are none.
140:             * @return A list of all encoding filters to apply to this stream.
141:             */
142:            public List getFilters() {
143:                return null;
144:            }
145:
146:            /**
147:             * This will set the filters that are part of this stream.
148:             * 
149:             * @param filters The filters that are part of this stream.
150:             */
151:            public void setFilters(List filters) {
152:                throw new UnsupportedOperationException(
153:                        "not supported for memory stream");
154:            }
155:
156:            /**
157:             * Get the list of decode parameters.  Each entry in the list will refer to 
158:             * an entry in the filters list.
159:             * 
160:             * @return The list of decode parameters.
161:             * 
162:             * @throws IOException if there is an error retrieving the parameters.
163:             */
164:            public List getDecodeParams() throws IOException {
165:                return null;
166:            }
167:
168:            /**
169:             * This will set the list of decode params.
170:             * 
171:             * @param decodeParams The list of decode params.
172:             */
173:            public void setDecodeParams(List decodeParams) {
174:                //do nothing
175:            }
176:
177:            /**
178:             * This will get the file specification for this stream.  This is only
179:             * required for external files.
180:             * 
181:             * @return The file specification.
182:             */
183:            public PDFileSpecification getFile() {
184:                return null;
185:            }
186:
187:            /**
188:             * Set the file specification.
189:             * @param f The file specification.
190:             */
191:            public void setFile(PDFileSpecification f) {
192:                //do nothing.
193:            }
194:
195:            /**
196:             * This will get the list of filters that are associated with this stream.  Or
197:             * null if there are none.
198:             * @return A list of all encoding filters to apply to this stream.
199:             */
200:            public List getFileFilters() {
201:                return null;
202:            }
203:
204:            /**
205:             * This will set the filters that are part of this stream.
206:             * 
207:             * @param filters The filters that are part of this stream.
208:             */
209:            public void setFileFilters(List filters) {
210:                //do nothing.
211:            }
212:
213:            /**
214:             * Get the list of decode parameters.  Each entry in the list will refer to 
215:             * an entry in the filters list.
216:             * 
217:             * @return The list of decode parameters.
218:             * 
219:             * @throws IOException if there is an error retrieving the parameters.
220:             */
221:            public List getFileDecodeParams() throws IOException {
222:                return null;
223:            }
224:
225:            /**
226:             * This will set the list of decode params.
227:             * 
228:             * @param decodeParams The list of decode params.
229:             */
230:            public void setFileDecodeParams(List decodeParams) {
231:                //do nothing
232:            }
233:
234:            /**
235:             * This will copy the stream into a byte array. 
236:             * 
237:             * @return The byte array of the filteredStream
238:             * @throws IOException When getFilteredStream did not work
239:             */
240:            public byte[] getByteArray() throws IOException {
241:                return data;
242:            }
243:
244:            /**
245:             * Get the metadata that is part of the document catalog.  This will 
246:             * return null if there is no meta data for this object.
247:             * 
248:             * @return The metadata for this object.
249:             */
250:            public PDMetadata getMetadata() {
251:                return null;
252:            }
253:
254:            /**
255:             * Set the metadata for this object.  This can be null.
256:             * 
257:             * @param meta The meta data for this object.
258:             */
259:            public void setMetadata(PDMetadata meta) {
260:                //do nothing
261:            }
262:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.