Code example for DefaultHttpClient

Methods: execute

0
    private InputStream fetchTileFromUrl(final String tileURLString) throws ClientProtocolException, IOException
    { 
      if (TextUtils.isEmpty(tileURLString)) 
        return null; 
 
      final HttpClient client = new DefaultHttpClient();
      final HttpUriRequest head = new HttpGet(tileURLString);
      final HttpResponse response = client.execute(head);
 
      final org.apache.http.StatusLine line = response.getStatusLine();
      if (line.getStatusCode() != 200) 
        return null; 
 
       final HttpEntity entity = response.getEntity();
       return (entity != null) ? entity.getContent() : null;
    } // fetchTileFromUrl 
     
    private byte[] loadTileByteArray(final InputStream in) throws IOException
    { 
      final ByteArrayOutputStream dataStream = new ByteArrayOutputStream();
      final OutputStream out = new BufferedOutputStream(dataStream, StreamUtils.IO_BUFFER_SIZE);