i have the following task:
an image file gets read via http-connection from a server. this byte-array is written to a recordstore and loaded for creating (restoring) the image.
theoretically this works fine. i got real devices and emulators which perform this without any issues but others seem to have quite big problems creating the image from recordstore.
i am very sure that the bytes get read from server and written into recordstore properly (number of bytes is correct, i can output the png-header etc).
first, the code to read and create the image:
public static Image getImage(String recordStoreName) throws RecordStoreFullException, RecordStoreNotFoundException, RecordStoreException, IOException
RecordStore store = RecordStore.openRecordStore(recordStoreName, false);
ByteArrayInputStream bais = new ByteArrayInputStream(store.getRecord(1));
DataInputStream in = new DataInputStream(bais);
int imageDataLength = in.readInt();
byte rawData = new byte[imageDataLength];
in.read(rawData, 0, rawData.length);
return Image.createImage(rawData, 0, imageDataLength);
the only modification ill do is to write an integer value at the beginning of the recordstore to measure the length of bytes to come.
the results are very different on phones:
sharp gx10 does it with no problems, others just hang or seem to have problems with creating the image from png data
Image.createImage(rawData, 0, imageDataLength);
there ill get BadArgumentExceptions (though im sure the png data is correct), EofExceptions (huh?) or the image is just not displayable.
any hints, comments, tips ?!