@ Override protected void onThresholdReached ( ) throws IOException { FileOutputStream aFOS = null ; try { aFOS = new FileOutputStream ( m_aOutputFile ) ; m_aMemoryOS . writeTo ( aFOS ) ; m_aCurrentOS = aFOS ; // Explicitly close the stream (even though this is a no-op) StreamHelper . close ( m_aMemoryOS ) ; m_aMemoryOS = null ; } catch ( final IOException ex ) { StreamHelper . close ( aFOS ) ; throw ex ; } }
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 .