Java Reference
In-Depth Information
} else
{
if (hadLF)
os.write(lineSep);
else
hadLF = true;
}
} else
{
if (inLineBreak)
{
os.write(lineSep);
hadCR = hadLF = inLineBreak = false;
}
os.write(ch);
}
}
} while (ch != -1);
}
/**
* Typical Java main method, create an object, and then
* pass the parameters on if provided, otherwise default.
*
* @param args URL to download, and local file.
*/
public static void main(String args[])
{
try
{
if (args.length != 2)
{
DownloadText d = new DownloadText();
d.download(
"http://www.httprecipes.com/1/3/text.php", "./text.html");
} else
{
DownloadText d = new DownloadText();
d.download(args[0], args[1]);
}
} catch (Exception e)
{
e.printStackTrace();
}
}
}
Search WWH ::




Custom Search