📄 httpresponse.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 + -