Hi all.
I used above code and created my image from data byte array :
while ((bytesRead = din.read(buffer)) > 0 ) {
// construct large enough array for all the data we now have
byte[] newData = new byte[data.length + bytesRead];
// copy data previously read
System.arraycopy(data, 0, newData, 0, data.length);
// append data newly read
System.arraycopy(buffer, 0, newData, data.length, bytesRead);
// discard the old array in favour of the new one
data = newData;
}
FileOutputStream f1;
File directory = new File("E:/Image/");
directory.mkdirs();
String path = "E:/Image/mayImage.jpg" ;
try {
f1 = new FileOutputStream(path);
f1.write(data);
f1.close();
} catch (IOException e) {
System.out.println("Problems creating the file");
}
the created image with name mayImage.jpg is not a valid image and its size is greater than original image size.
how you created your image form these data(maybe i do something wrong after reading data and writing in a file).
Thanks in advance!