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、将org.vssplugin_1.6.2文件夹及文件夹中的内容copy到...\Genuitec\Common\plugins目录下。
2、在目录...\Genuitec\MyEclipse 7.0\configuration\org.eclipse.equinox.simpleconfigurator 的文件bundles.info最后加一行
org.vssplugin,1.6.2,file:plugins\org.vssplugin_1.6.2\,4,false
3、重启MyEclipse7.0即可  ......
一.用引用操纵对象
每种编程语言都有自己的数据操纵方式。有时候,程序员必须注意将要处理的数据是什么类型。你是直接操纵对象,还是用某种基于特殊语法的间接表示(例如C和C++里的指针)在操纵对象?
所有的这一切在java里都得到了简化 ......
通常情况下,我们在写一个类时,一般会赋予它一个或几个public的构造函数,让外部程序能够创建对象. 然而,在effective java 中,从另一个角度告诫我们在使用public的构造函数前,先考虑用public 的静态函数来创建对象.
其优点如下:
1. 一个静态的工厂函数,可以取不同的名字. 而构造函数的名字只能与类同名.
......