public long getLogFileTimestamp ( File file ) { if ( file == null ) { return - 1L ; } String name = file . getName ( ) ; // Check name for extension if ( name == null || name . length ( ) == 0 || ! name . endsWith ( EXTENSION ) ) { return - 1L ; } try { return Long . parseLong ( name . substring ( 0 , name . indexOf ( EXTENSION ) ) ) ; } catch ( NumberFormatException ex ) { return - 1L ; } }
Retrieves the timestamp from the name of the file .