Is there anyway to check whether an OutputStream is closed without attempting to write to it and catching the IOException
?
For example, consider the following contrived method:
public boolean isStreamClosed(OutputStream out){
if( /* stream isn't closed */){
return true;
}else{
return false;
}
}
What could you replace /* stream isn't closed */
with?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…