@Override protected void thresholdReached() throws IOException {
  if (prefix != null) {
    outputFile=File.createTempFile(prefix,suffix,directory);
  }
  FileOutputStream fos=new FileOutputStream(outputFile);
  memoryOutputStream.writeTo(fos);
  currentOutputStream=fos;
  memoryOutputStream=null;
}

@ Override protected void thresholdReached ( ) throws IOException { if ( prefix != null ) { outputFile = File . createTempFile ( prefix , suffix , directory ) ; } FileOutputStream fos = new FileOutputStream ( outputFile ) ; memoryOutputStream . writeTo ( fos ) ; currentOutputStream = fos ; memoryOutputStream = null ; }
switches the underlying output stream from a memory based stream to one that is backed by disk . this is the point at which we realise that too much data is being written to keep in memory , so we elect to switch to disk - based storage .
