private File getFileForEvent ( File collectionDir , Calendar timestamp ) throws IOException { int counter = 0 ; File eventFile = getNextFileForEvent ( collectionDir , timestamp , counter ) ; while ( eventFile . exists ( ) ) { eventFile = getNextFileForEvent ( collectionDir , timestamp , counter ) ; counter ++ ; } return eventFile ; }
Gets the file to use for a new event in the given collection with the given timestamp . If there are multiple events with identical timestamps this method will use a counter to create a unique file name for each .