Could you help where am I making the mistake.. i did not use byte[] buffer as that is another approach. But is there a way to correct the one I wrote?