1 31 package org.pdfbox.pdmodel.common; 32 33 import java.io.ByteArrayInputStream ; 34 import java.io.IOException ; 35 import java.io.InputStream ; 36 import java.io.OutputStream ; 37 38 import java.util.List ; 39 40 import org.pdfbox.cos.COSBase; 41 import org.pdfbox.cos.COSStream; 42 43 import org.pdfbox.pdmodel.common.filespecification.PDFileSpecification; 44 45 52 public class PDMemoryStream extends PDStream 53 { 54 private byte[] data; 55 56 61 public PDMemoryStream( byte[] buffer ) 62 { 63 data = buffer; 64 } 65 66 67 68 72 public void addCompression() 73 { 74 } 76 77 78 79 84 public COSBase getCOSObject() 85 { 86 throw new UnsupportedOperationException ( "not supported for memory stream" ); 87 } 88 89 96 public OutputStream createOutputStream() throws IOException 97 { 98 throw new UnsupportedOperationException ( "not supported for memory stream" ); 99 } 100 101 108 public InputStream createInputStream() throws IOException 109 { 110 return new ByteArrayInputStream ( data ); 111 } 112 113 121 public InputStream getPartiallyFilteredStream( List stopFilters ) throws IOException 122 { 123 return createInputStream(); 124 } 125 126 131 public COSStream getStream() 132 { 133 throw new UnsupportedOperationException ( "not supported for memory stream" ); 134 } 135 136 142 public int getLength() 143 { 144 return data.length; 145 } 146 147 152 public List getFilters() 153 { 154 return null; 155 } 156 157 162 public void setFilters( List filters ) 163 { 164 throw new UnsupportedOperationException ( "not supported for memory stream" ); 165 } 166 167 175 public List getDecodeParams() throws IOException 176 { 177 return null; 178 } 179 180 185 public void setDecodeParams( List decodeParams ) 186 { 187 } 189 190 196 public PDFileSpecification getFile() 197 { 198 return null; 199 } 200 201 205 public void setFile( PDFileSpecification f ) 206 { 207 } 209 210 215 public List getFileFilters() 216 { 217 return null; 218 } 219 220 225 public void setFileFilters( List filters ) 226 { 227 } 229 230 238 public List getFileDecodeParams() throws IOException 239 { 240 return null; 241 } 242 243 248 public void setFileDecodeParams( List decodeParams ) 249 { 250 } 252 253 259 public byte[] getByteArray() throws IOException 260 { 261 return data; 262 } 263 264 270 public PDMetadata getMetadata() 271 { 272 return null; 273 } 274 275 280 public void setMetadata( PDMetadata meta ) 281 { 282 } 284 } | Popular Tags |