Code example for DataInputStream

Methods: readLine

0
 
        // Execute the GET transaction and read the results 
        int status = resp.getStatusLine().getStatusCode();
        if( status != HttpStatus.SC_OK )
                throw new IOException( "HTTP status: "+Integer.toString( status ) );
        DataInputStream is = new DataInputStream( resp.getEntity().getContent() );
        result = is.readLine();
        return result;
 
    } 
 
        private void maybeCreateHttpClient() { 
            if ( httpClient == null) {
                httpClient = new DefaultHttpClient();
                HttpParams params = httpClient.getParams();
                HttpConnectionParams.setConnectionTimeout(params, REGISTRATION_TIMEOUT);
                HttpConnectionParams.setSoTimeout(params, REGISTRATION_TIMEOUT);
                ConnManagerParams.setTimeout(params, REGISTRATION_TIMEOUT);
            } 
    } 
}