Java serialization, ObjectInputStream.readObject(), check if will block

前端 未结 4 1776
别跟我提以往
别跟我提以往 2020-12-03 16:14

I\'m using an ObjectInputStream to call readObject for reading in serialized Objects. I would like to avoid having this method block,

4条回答
  •  心在旅途
    2020-12-03 16:59

    No. Although you could use the ObjectInputStream in another thread and check to see whether that has an object available. Generally polling isn't a great idea, particularly with the poor guarantees of InputStream.available.

提交回复
热议问题