net.roboconf.core.utils.Utils.removeFileExtension()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中net.roboconf.core.utils.Utils.removeFileExtension()方法的一些代码示例,展示了Utils.removeFileExtension()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.removeFileExtension()方法的具体详情如下:
包路径:net.roboconf.core.utils.Utils
类名称:Utils
方法名:removeFileExtension

Utils.removeFileExtension介绍

[英]Removes the extension from a file name.
[中]

代码示例

代码示例来源:origin: net.roboconf/roboconf-dm-scheduler

@Override
public List<ScheduledJob> listJobs() {
  this.logger.fine( "Roboconf's scheduler is listing jobs..." );
  List<ScheduledJob> result = new ArrayList<> ();
  for( File f : Utils.listAllFiles( getSchedulerDirectory(), Constants.FILE_EXT_PROPERTIES )) {
    Properties props = Utils.readPropertiesFileQuietly( f, this.logger );
    if( props.isEmpty())
      continue;
    // Inject the ID in the properties
    props.put( JOB_ID, Utils.removeFileExtension( f.getName()));
    ScheduledJob job = from( props );
    result.add( job );
  }
  Collections.sort( result );
  return result;
}

代码示例来源:origin: net.roboconf/roboconf-dm-scheduler

@Override
public void loadJobs() {
  this.logger.fine( "Roboconf's scheduler is loading jobs..." );
  for( File f : Utils.listAllFiles( getSchedulerDirectory(), Constants.FILE_EXT_PROPERTIES )) {
    try {
      Properties props = Utils.readPropertiesFileQuietly( f, this.logger );
      // Inject the ID in the properties
      props.setProperty( JOB_ID, Utils.removeFileExtension( f.getName()));
      // Validate and reload
      if( validProperties( props ))
        scheduleJob( props );
      else
        this.logger.warning( "Skipped schedule for a job. There are invalid or missing job properties in " + f.getName());
    } catch( Exception e ) {
      // Catch ALL the exceptions. #start() cannot fail.
      this.logger.warning( "Failed to load a scheduled job from " + f.getName());
      Utils.logException( this.logger, e );
    }
  }
}

代码示例来源:origin: net.roboconf/roboconf-dm

String prefix = Utils.removeFileExtension( targetPropertiesFile.getName());
File scriptsInDir = new File( targetPropertiesFile.getParentFile(), prefix );
File scriptsOutDir = new File( findTargetDirectory( targetId ), Constants.PROJECT_SUB_DIR_SCRIPTS );

代码示例来源:origin: roboconf/roboconf-platform

@Test
public void testRemoveFileExtension() {
  Assert.assertEquals( "", Utils.removeFileExtension( "" ));
  Assert.assertEquals( "test", Utils.removeFileExtension( "test" ));
  Assert.assertEquals( "test", Utils.removeFileExtension( "test.txt" ));
  Assert.assertEquals( "test", Utils.removeFileExtension( "test.jpg" ));
  Assert.assertEquals( "test.jpg", Utils.removeFileExtension( "test.jpg.txt" ));
}

相关文章