inputstream.jsp

来自「机械工业出版社的《jsp2.0动态网站开发实例指南》的源代码」· JSP 代码 · 共 30 行

JSP
30
字号
<!--inputstream.jsp-->
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.io.*"%>
<html>
<head>
<title>InputStream</title>
</head>
<body>
<h1>
<%	
	try{
		File myfile=new File("E:/temp1/inputstream.txt");
		FileInputStream in=new FileInputStream(myfile);
		BufferedInputStream bufferin=new BufferedInputStream(in);
		byte b[]=new byte[20];
		int n=0;
		while((n=bufferin.read(b))!=-1){
			String temp=new String (b,0,n);
			out.print(temp);
		}
		bufferin.close();
		in.close();
	}
	catch(IOException e){		
		out.println("error!");
	}	
%>
</h1>
</body>
</html>

⌨️ 快捷键说明

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