1 34 35 36 package com.micronova.util; 37 38 import javax.activation.*; 39 import java.io.*; 40 41 42 43 public class ByteArrayDataSource implements DataSource 44 { 45 protected String _contentType; 46 protected String _name; 47 protected byte[] _array; 48 49 public ByteArrayDataSource(String contentType, String name, byte[] array) 50 { 51 _contentType = contentType; 52 _name = name; 53 _array = array; 54 } 55 56 public String getContentType() 57 { 58 return _contentType; 59 } 60 61 public String getName() 62 { 63 return _name; 64 } 65 66 public InputStream getInputStream() throws IOException 67 { 68 return new ByteArrayInputStream(_array); 69 } 70 71 public OutputStream getOutputStream() throws IOException 72 { 73 throw new IOException("unsupported"); 74 } 75 } 76 | Popular Tags |