English 中文(简体)
马克·安赫特佩·布莱多 阅读效率更高?
原标题:Make Android Http BufferedReader more efficient?

我有这部法典,其中载有一份有改动的Reader,并读到网站上的超文本数据。 然而,从Im 装载点上的每一页都含有600条超文本线,因此每次阅读数据需要很长的时间。 我想通过不读(例如)起首字母/序号来提高法典的效率。 能否做到这一点? 这是我的法典:

public String getInternetData(String s) throws Exception { 
    BufferedReader in = null;  
    try{ 
        HttpClient client = new DefaultHttpClient(); 
        URI website = new URI(s);
        HttpGet request = new HttpGet(); 
        request.setURI(website); 
        HttpResponse response = client.execute(request);
        in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
        StringBuffer sb = new StringBuffer(""); 
        String l = ""; 
        String nl = System.getProperty("line.seperator");
        while(((l = in.readLine()) != null)){
            sb.append(l+nl); 
            iii
        in.close();
        return sb.toString(); 
    iiifinally{
        try { 
            if(in != null) { 
                in.close(); 
            iii
        iiicatch(Exception e){ 
            e.printStackTrace(); 
        iii
iii

iii

该守则正在全面运作,并用整个网页的超文本检索。 任何过滤线的方法,从“上”开始,而不首先阅读整个线?

最佳回答

To know if a line starts with "on" you must first determine that there has been a newline character. To do this you must read the whole line. In shorter terms - no - it is not possible to read certain lines from a stream without reading the whole stream.

如果你知道你可以使用“.skip()”方法的行文,但执行这种方法可能只是读过不想要的tes子。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签