java.Io n java.net
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   SeethaRamaKrishna_kurra
Posted On:   Monday, March 7, 2005 11:34 PM

my requirment i have to create a folder and place the files into the folder. The content in each file is saved separately as html file. I am using java.net and java.io packages Here folder is containing urls of each site and the content of each url i have to save in individual html files. public static void connectToWebPage(HttpURLConnection connection) { try { int numWords = 0; brWebPage = new BufferedReader( new InputStreamReader( connection .getInputStream())); String inputLine; while ((inputLine = brWebPage .readLine()) != null) { lineNumber++; content.write(inputLine); content.write(   More>>

my requirment i have to create a folder and place the files into the folder.
The content in each file is saved separately as html file.
I am using java.net and java.io packages
Here folder is containing urls of each site and the content of each url i have to save in individual html files.

			
public static void connectToWebPage(HttpURLConnection connection)
{
try {
int numWords = 0;


brWebPage = new BufferedReader(
new InputStreamReader(
connection
.getInputStream()));
String inputLine;


while ((inputLine = brWebPage
.readLine()) != null) {

lineNumber++;

content.write(inputLine);
content.write("
");

eachHtmlFile.write(inputLine);
eachHtmlFile.write("
");

}

}
catch(Exception e)
{
System.out.println(e);
}


}



here i had problem that eachHtmlFile.write(inputline).
each time when a new url is connected the content ie. source code is appended to same eachHtmlFile.
I need for each url i want to open a new file. and save the source code of each url in that new file.


thanks (advance),
ramu.
.    <<Less
About | Sitemap | Contact