• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about URL access (Please help me

 
alanchang
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why can't display BIG5 character
my code is -->
import java.net.*;
import java.io.*;
//import java.io.InputStreamReader;
//import java.io.OuputStreamReader;
/*
BufferedReader in =new BufferedReader(new FileReader("IOStreamDemo.java"));
String s, s2 = new String();
while((s = in.readLine())!= null)
s2 += s + "\n";
in.close();
*/
class OpenStreamTest {
public static void main(String[] args)
{
try {
URL yahoo = new URL("http://tisv.tpis.nat.gov.tw/Exchange/PARKX01/park.csv");
DataInputStream dis =new DataInputStream(yahoo.openStream());
String inputLine;
BufferedWriter kow=new BufferedWriter(new FileWriter("C:/ko24_6.out"));
while((inputLine = dis.readLine())!=null)
{
//�g�J������
inputLine=inputLine+"\n";
System.out.println(inputLine);
String line;
kow.write(inputLine,0,inputLine.length());
//kow.flush();
//�q�������X
BufferedReader kor=new BufferedReader(new FileReader("C:/ko24_6.out"));
line=kor.readLine();
System.out.println(line);
}
kow.flush();
dis.close();

}catch(MalformedURLException me){
System.out.println("MalformedURLException:"+me);

}catch(IOException ioe){
System.out.println("IOException:"+ ioe);
}

}
}
<-- my code
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alan -
Please take a look at JavaRanch's naming policy. To maintain a professional appearance, we ask that you register with first and last names separated by a space. The site supports that just fine.
Also, you can use HTML or UBB markups to format your code. This not only makes your source far easier to read, it's likely more people will look at it close enough to see problems.
Welcome to JavaRanch!
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic