java 读取的几种方式

java 读取的几种方式
InputStream in  =  url_con.getInputStream();
            
            
byte [] buf  =   new   byte [ 1024 ];
            
int  len  =   0 ;
            
while  ((len  =  in.read(buf))  !=   - 1 ) {
                temp.append(
new String(buf,0, len));
            }

            setContentStr(temp.toString());
InputStream in =  url_con.getInputStream();
            BufferedReader   rd 
=   new  BufferedReader( new  InputStreamReader(in));
            StringBuilder tempStr
= new  StringBuilder();

            
while  (rd.ready()) {
                tempStr.append(rd.readLine());
            }

           setResponse_content(
new  String(tempStr));

你可能感兴趣的:(java 读取的几种方式)