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

📄 httpresponse.java

📁 通讯计费系统
💻 JAVA
字号:
package cfq.fare.res_req;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;


public class HttpResponse {
	
	OutputStream out=null;
	
	public HttpResponse(OutputStream out){
		this.out=out;
	}
	
	//返回普通文本内容
	public void resText(String text){
		try {
			out.write(text.getBytes());
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	//返回指定文件的内容
	public void resFileContent(String path){
		File file=null;
		FileInputStream fis=null;
		try {
			file=new File(path);
			fis=new FileInputStream(file);
			int b=-1;
			while((b=fis.read())!=-1){
				out.write(b);
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}

}

⌨️ 快捷键说明

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