⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fileserviceimpl.java

📁 struts spring hibernate文件上传下载
💻 JAVA
字号:
package com.richard.business.impl;

import java.io.IOException;
import java.io.OutputStream;
import java.util.List;

import com.richard.business.IFileService;
import com.richard.model.TFile;

public class FileServiceImpl implements IFileService {
	private com.richard.model.TFileDAO dao;

	public void setDao(com.richard.model.TFileDAO dao) {
		this.dao = dao;
	}

	public void create(TFile tFile) {
		this.dao.save(tFile);
	}

	public List getAllFile() {
		return this.dao.findAll();
	}

	public String getFileName(Long fileId) {
		return this.dao.findById(fileId).getFileName();
	}

	public void write(OutputStream os, Long fileId) {
		TFile tfile = this.dao.findById(fileId);
		try {
			os.write(tfile.getFileContent());
			os.flush();
		} catch (IOException ex) {
			throw new RuntimeException(ex);
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -