generate byte array from StringBuffer.toString
<p>What I'm trying to do is to generate a byte array from a url.</p>

<pre><code>byte[] data = WebServiceClient.download(url);
</code></pre>

<p>The <code>url</code> returns json</p>

<pre><code>public static byte[] download(String url) {
    HttpClient client = new DefaultHttpClient();
    HttpGet get = new HttpGet(url);
    try {
        HttpResponse response = client.execute(get);
        StatusLine status = response.getStatusLine();
        int code = status.getStatusCode();
        switch (code) {
            case 200:
                StringBuffer sb = new StringBuffer();
                HttpEntity entity = response.getEntity();
                InputStream is = entity.getContent();
                BufferedReader br = new BufferedReader(new InputStreamReader(is));
                String line;
                while ((line = br.readLine()) != null) {
                    sb.append(line);
                }
                is.close();

                sContent = sb.toString();

                break;       
        }
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    return sContent.getBytes();
}
</code></pre>

<p>This <code>data</code> is used as a parameter for <code>String</code></p>

<pre><code>String json = new String(data, "UTF-8");
JSONObject obj = new JSONObject(json);
</code></pre>

<p>for some reason, I get this error</p>

<pre><code>I/global  (  631): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
</code></pre>

<p>I think something there must be missing here <code>sContent = sb.toString();</code> or here <code>return sContent.getBytes();</code> but I'm not sure though.</p>
