title: Reading PNG file from the stream
body: <p>I trying to build RDP application for android mobile.so in server side i am sending the png images with the robot class, but in client side i am not able to read that messages and print them on my android device.</p>
  
  <p>i am using following code to read the JPEG file body data and i am able to show those images </p>
  
  <pre><code>InputStream in = sock.getInputStream();
  while(true)
  {
  byte[] bytes = new byte[1024*1024];
  int count = 0;
  do
  {
  count+= in.read(bytes,count,bytes.length-count);
  }
  while(!(count&gt;4&amp;&amp;bytes[count-2]==(byte)-1 &amp;&amp; bytes[count-1]==(byte)-39));
  
  }
  </code></pre>
  
  <p>can any one help me how to read the png file out of the inputstream.</p>