package foundation.io.object;
|
|
import java.io.File;
|
import java.io.IOException;
|
import java.io.InputStream;
|
|
import org.apache.commons.fileupload.FileItem;
|
|
|
public class FileItemAgent {
|
|
private FileItem fileItem;
|
private String name;
|
private File path;
|
|
|
public FileItemAgent() throws Exception {
|
|
}
|
|
public void setFileItem(FileItem fileItem) {
|
this.fileItem = fileItem;
|
name = fileItem.getName();
|
}
|
|
public void write(File file) throws Exception {
|
fileItem.write(file);
|
}
|
|
public String getName() {
|
return name;
|
}
|
|
public InputStream getInputStream() throws IOException {
|
return fileItem.getInputStream();
|
}
|
|
public File getPath() {
|
return path;
|
}
|
|
public String getContentType() {
|
return fileItem.getContentType();
|
}
|
|
public Long getSize() {
|
return fileItem.getSize();
|
}
|
|
public void setPath(File path) {
|
this.path = path;
|
}
|
|
public boolean isEmpty() {
|
return fileItem == null;
|
}
|
|
}
|