I am not aware of a way to do this directly from a standard MIDP device. I believe their is a way if you are using a BlackBerry. That said, you can achieve a similar result and prevent your application from hanging by using threads.
Perform your IO related operations in one
thread, using a the main (UI) thread or another thread to monitor the progress of your IO related thread. If your timeout interval elapses you can then alert the user, set a flag to indicate that the IO thread should not continue (i.e. if open succeeds after, do not read, etc).