hello, i m developing an application in j2me which features a Bluetooth Communication of an object of a user-defined class. I received the byte array using following code:
public byte[] receiveBoard() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
ins = conn.openInputStream();
int n;
while((n=ins.read(brd))>0) {
baos.write(brd, 0, n);
}
} catch(Exception e) {
System.err.println(e);
}
return baos.toByteArray();
}
- Correct me if this code is having mistakes.
Now my problem is,
- i m not able to convert this "byte array" back to the requird instance of user-defined class. I m not able to retrieve my 'initial object' from the byte array, so that i can use it in my application again after the reception.
i tried using ObjectInputStream, ObjectInput classes but it is not importing those packages!! Please Please help me fast!!!!