title: How to avoid this java.io.IOException: No space left on device
body: <p>If my space is full I get sometimes following exception</p>
  
  <pre><code>java.io.IOException: No space left on device
          at java.io.FileOutputStream.writeBytes(Native Method)
          at java.io.FileOutputStream.write(FileOutputStream.java:282)
          at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1847)
          at java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java:1756)
          at java.io.ObjectOutputStream.&lt;init&gt;(ObjectOutputStream.java:230)
  </code></pre>
  
  <p>Is there any way in Java to avoid this. I mean do not call write if no space</p>