I am getting the exception as in the Title while sending an image to a java server
Here's the code:
ByteArrayOutputStream stream = new ByteArrayOutputStream();
img.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
String imageDataString = new String(Base64.encodeBase64(byteArray));
System.out.println(imageDataString);
dataOutputStream.writeUTF(imageDataString);
dataOutputStream.flush();
Where img
is a bitmap file.
Any help will be highly appreciated !