关于JSP的输入输出流的问题
我用JBuilder 7 Enterprise编辑JSP的代码如下:
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="java.io.*"%>
<html>
<head>
</head>
<body>
</body>
<%
int b;
byte buffer[]=new byte[2500000];
try
{
FileInputStream readfile=new FileInputStream("c:\\bc.txt");
b=readfile.read(buffer,0,2500000) ;
try
{
String str=new String(buffer,0,b,"Default");
String ss=new String(str.getBytes("ISO8859-1"));
System.out.println(ss) ;
out.println(ss);
}
catch(UnsupportedEncodingException e)
{System.out.println("the");}
}
catch(IOException e)
{System.out.println("file read error");}
%>
</html>
现在有两个问题,
第一,我将一个文本文件里的内容读到IE的页面上,如果内容是阿拉伯数字或者英文字母都可以,但是如果读到中文不是显示????就是显示乱码,请问应该如何解决。
第二,如果我想将一个很大的文本文件里的内容(可以有几个M),请问应该如何进行操作。