title: Can I set a timeout for a InputStream's read() function?
body: <p>I have a <code>DataInputStream</code> that I obtained from a <code>Socket</code>. Is there any way I can set a timeout for <code>dis.read(...)</code>? Currently I spawn a new thread to do the read. While the parent thread does a <code>thread.join(timeout)</code> to wait before interrupting it. I am aware of nio, but I don't think I want to refactor that much at this point. Thanks.</p>