1 16 package org.apache.cocoon.servlet.multipart; 17 18 import java.io.IOException ; 19 import java.io.InputStream ; 20 import java.util.Map ; 21 22 28 public class PartInMemory extends Part { 29 30 private InputStream in; 31 32 private int size; 33 34 41 public PartInMemory(Map headers, InputStream in, int size) { 42 super(headers); 43 this.in = in; 44 this.size = size; 45 } 46 47 50 public String getFileName() { 51 return (String ) headers.get("filename"); 52 } 53 54 57 public int getSize() { 58 return this.size; 59 } 60 61 66 public InputStream getInputStream() throws IOException { 67 if (this.in != null) { 68 return this.in; 69 } else { 70 throw new IllegalStateException ("This part has already been disposed."); 71 } 72 } 73 74 77 public void dispose() { 78 this.in = null; 79 } 80 } 81 | Popular Tags |