java常用类 blobFileBean
package com.whlongyi.sys.blob.bean;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.myfaces.custom.fileupload.UploadedFile;
import com.whlongyi.common.util.FacesUtils;
import com.whlongyi.sys.blob.bo.BlobFile;
import com.whlongyi.sys.blob.service.BlobFileService;
public class BlobFileBean {
public final static String uploadPath="uploadFile";
private BlobFileService blobFileService;
public BlobFileService getBlobFileService() {
return blobFileService;
}
public void setBlobFileService(BlobFileService blobFileService) {
this.blobFileService = blobFileService;
}
public String downLoadFile()
{
String blobId=FacesUtils.getRequestParameter("blobFileID");
BlobFile blobVO=blobFileService.getBlobFile(Integer.parseInt(blobId));
HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
ServletContext servletContext=FacesUtils.getServletContext();
InputStream s = new java.io.ByteArrayInputStream(blobVO.getFileContent());
BufferedInputStream bis = new BufferedInputStream(s);
String realName=blobVO.getName();
String extendName=null;
try {
 
相关文档:
线性表,链表,集合,哈希表是常用的数据结构,在进行Java开发时,JDK已经为我们提供了一系列相应的类来实现基本的数据结构。这些类均在java.util包中。
Collection
├List
│├LinkedList
│├ArrayList
│└Vector
│ └Stack
└Set
Map
├Hashtable
├HashMap
└WeakHashMap
主要分为两个分支:
Collectio ......
1.基本概念的理解
绝对路径:绝对路径就是你的主页上的文件或目录在硬盘上真正的路径,(URL和物理路径)例如:
C:\xyz\test.txt 代表了test.txt文件的绝对路径。http://www.sun.com/index.htm也代表了一个URL绝对路径。
相对路径:相对与某个基准目录的路径。包含Web的相对路径(HTML中的相对目录),例如:在Ser ......
Java的内存泄漏
===========================================================
作者: shwenwen(http://shwenwen.itpub.net)
发表于: 2009.06.04 10:38
分类: java开发技术
出处: http://shwenwen.itpub.net/post/34911/485404
---------------------------------------------------------------
不管用java C++ ......