Reading DataInputStream From Server
<p>I am trying to get DataInputStream from Server,its giving me Number format exception ,First I try below code to read the DataInputStream,any suggestion where I am doing wrong </p>

<pre><code>    if (_in == null) {
        _in = urlConnection.getInputStream();
    }
    if (_din == null) {
        _din = new DataInputStream(_in);
    }
    try {
        byte[] data = null;
        if (_din != null) {
            data = new byte[0];
            byte[] buffer = new byte[1024];
            int bytesRead;
            while ((bytesRead = _din.read(buffer)) &gt; 0) {
                byte[] newData = new byte[data.length + bytesRead];
                System.arraycopy(data, 0, newData, 0, data.length);
                System.arraycopy(buffer, 0, newData, data.length, bytesRead);
                data = newData;
            }
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    ByteArrayBuffer baf = null;
    try {
        BufferedInputStream bis = new BufferedInputStream(_in);
        baf = new ByteArrayBuffer(512);
        int current = 0;
        while ((current = bis.read()) != -1) {
            baf.append((byte) current);
        }
    } catch (Exception e) {// TODO Auto-generated catch block
        e.printStackTrace();
    }
</code></pre>

<p>After that I also 2nd method to which is some similar to above one,but both giving me same exception as in attachment,!
        <img src="http://i.stack.imgur.com/wW2cf.png" alt="enter image description here"></p>
