Not all InputStream
s are guaranteed to be selectable, so there is no straightforward way to do this. It's unfortunate that the CommPort
class doesn't have a method for returning a SelectableChannel
; there is no easy, portable way to accomplish this (i.e., without completely breaking encapsulation).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…