Adds error handling for module startup to processing chain and adds file

existance checking for recording files before attempting to create them.
This commit is contained in:
denny
2015-12-31 10:05:26 -05:00
parent c82fc54fbd
commit 97a1b18071
2 changed files with 18 additions and 1 deletions

View File

@@ -96,6 +96,16 @@ public class WaveWriter implements AutoCloseable
*/
private void open() throws IOException
{
int version = 2;
while( Files.exists( mFile ) )
{
mFile = Paths.get( mFile.toFile().getAbsolutePath()
.replace( ".wav", "_" + version + ".wav" ) );
version++;
}
Files.createFile( mFile );
mFileChannel = (FileChannel.open( mFile, StandardOpenOption.WRITE ) );