• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
Bartenders:
  • Himai Minh
  • Carey Brown
  • Frits Walraven

about URL access (Please help me

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic