1 22 package org.objectweb.petals.engine.csv; 23 24 import java.io.ByteArrayInputStream ; 25 import java.io.IOException ; 26 import java.io.InputStream ; 27 import java.io.OutputStream ; 28 29 import javax.activation.DataSource ; 30 31 32 39 public class ByteArrayDataSource implements DataSource { 40 41 private String content; 42 43 44 public ByteArrayDataSource(String content) { 45 this.content = content; 46 } 47 48 public String getContentType() { 49 return "test/plain"; 50 } 51 52 public InputStream getInputStream() throws IOException { 53 return new ByteArrayInputStream (content.getBytes()); 54 } 55 56 public String getName() { 57 return content; 58 } 59 60 public OutputStream getOutputStream() throws IOException { 61 throw new IOException ("not supported"); 62 } 63 64 } 65 | Popular Tags |