title: How to clear an inputstream in java
body: <p>I have data coming from a bluetooth device, the data is being stored in an inputstream. I am taking the data from the inputstream and generating a graphic with Jfreechart. Whenever I turn off the bluetooth device the data keeps coming from the inputstream and the graphic continues being generated.</p>
  
  <p>I need the data and the graphic to stop when I turn off the bluetooth device.</p>
  
  <p>I am using Java.</p>