RE: парсинг html
public class URL_Reader
{
private static int BUFFER_SIZE=164;
/************************************************** ************************************************** ***************
* Load HTML page from the provided source. Very slow :-(
************************************************** ************************************************** ***************/
protected final StringBuffer read(final String url)
throws Exception
{
final URLConnection url_con = new URL(url).openConnection();
final InputStreamReader reader = new InputStreamReader(url_con.getInputStream());
final StringBuffer buffer_s = new StringBuffer(BUFFER_SIZE);
int length=0;
while (true)
{
int i = reader.read();
if (i==-1) break;
char x = (char)i;
buffer_s.append(x);
length++;
}
reader.close();
return buffer_s;
}
}
|