How to read byte array from network using servlet/jsp
807603Nov 16 2007 — edited Nov 16 2007hai
I am in need of reading a byte array from the network using servlet.
Actually reading as a string and converting it into a byte array is not worthy, why because it makes some precision loss so I am in need of reading byte array itself. I have used ServletInputStream to read the byte array but it does not reads exactly.
my code is here...
int n=request.getContentLength();
byte[] data=new byte[n];
InputStream inputStream=request.getInputStream();
input.read(data);
If I convert the readed byte array to String and print it nothing is there. But
got the byte array. Also checked with the input byte array it does not same.
Please, anyone help me to solve this problem.
Thanks in advance.