当前位置: 首页>>代码示例>>Java>>正文


Java FilenameUtils.removeExtension方法代码示例

本文整理汇总了Java中org.apache.commons.io.FilenameUtils.removeExtension方法的典型用法代码示例。如果您正苦于以下问题:Java FilenameUtils.removeExtension方法的具体用法?Java FilenameUtils.removeExtension怎么用?Java FilenameUtils.removeExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.io.FilenameUtils的用法示例。


在下文中一共展示了FilenameUtils.removeExtension方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: FSScanPosRead

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
private boolean FSScanPosRead() {
    if (!new File(FilenameUtils.removeExtension(filename) + ".ScanPosFS").exists()) {
        return false;
    }
    try {
        Logger.getRootLogger().debug("Reading ScanPos:" + FilenameUtils.removeExtension(filename) + ".ScanPosFS...");
        FileInputStream fileIn = new FileInputStream(FilenameUtils.removeExtension(filename) + ".ScanPosFS");
        FSTObjectInput in = new FSTObjectInput(fileIn);
        ScanIndex = (TreeMap<Integer, Long>) in.readObject();
        TotalScan = ScanIndex.size();
        in.close();
        fileIn.close();

    } catch (Exception ex) {
        Logger.getRootLogger().debug("ScanIndex serialization file failed");
        //Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
        return false;
    }
    return true;
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:21,代码来源:mzXMLParser.java

示例2: add

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
@Override
public void add( String filepattern ) {
  try {
    if ( filepattern.endsWith( ".ours" ) || filepattern.endsWith( ".theirs" ) ) {
      FileUtils.rename( new File( directory, filepattern ),
          new File( directory, FilenameUtils.removeExtension( filepattern ) ),
          StandardCopyOption.REPLACE_EXISTING );
      filepattern = FilenameUtils.removeExtension( filepattern );
      org.apache.commons.io.FileUtils.deleteQuietly( new File( directory, filepattern + ".ours" ) );
      org.apache.commons.io.FileUtils.deleteQuietly( new File( directory, filepattern + ".theirs" ) );
    }
    git.add().addFilepattern( filepattern ).call();
  } catch ( Exception e ) {
    showMessageBox( BaseMessages.getString( PKG, "Dialog.Error" ), e.getMessage() );
  }
}
 
开发者ID:HiromuHota,项目名称:pdi-git-plugin,代码行数:17,代码来源:UIGit.java

示例3: test_unpack

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
@Test
public void test_unpack() {
    ArchiveBean archiveBean = new ArchiveBean();
    try {
        archiveBean.afterPropertiesSet();
        archiveBean.setUseLocalFileMutliThread(false);
    } catch (Exception e1) {
        want.fail();
    }

    File archiveFile = new File("/tmp/otter/test.gzip");
    // for (File archiveFile : archiveFiles.listFiles()) {
    // if (archiveFile.isDirectory()) {
    // continue;
    // }
    //
    // if (!"FileBatch-2013-03-07-16-27-05-245-369-3209577.gzip".equals(archiveFile.getName())) {
    // continue;
    // }

    System.out.println("start unpack : " + archiveFile.getName());
    File targetFile = new File("/tmp/otter", FilenameUtils.removeExtension(archiveFile.getName()));
    archiveBean.unpack(archiveFile, targetFile);
    // }
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:26,代码来源:ArchiveBeanIntegration.java

示例4: forGfaFile

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
/**
 * Uses a GFA file to determine the destination and constructs a new {@link Snapshot}.
 *
 * @param gfaFile a {@link GfaFile} instance
 * @return a new {@link Snapshot}
 */
public static Snapshot forGfaFile(final GfaFile gfaFile) {
    final File file = new File(gfaFile.getFileName());
    final String gfaFileNameWithoutExtension = FilenameUtils.removeExtension(file.getName());

    final String fileName = gfaFileNameWithoutExtension + "_snapshot_" + new Date().getTime() + "." + FILE_FORMAT;
    final File destination = new File(file.getParent(), fileName);

    return new Snapshot(destination);
}
 
开发者ID:ProgrammingLife2017,项目名称:hygene,代码行数:16,代码来源:Snapshot.java

示例5: saveAll

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
private Void saveAll() {
  File selectedFile = IOUtility.selectFileToSave(FileType.ONTOLOGY);
  if (selectedFile != null) {
    String fileName = FilenameUtils.removeExtension(selectedFile.getAbsolutePath());
    for (int i = 0; i < objects.getCount(); i++) {
      TreeNode node = objects.getNode(i);
      saveObject(fileName, node.getType(), node.getUserObject());
    }
  }
  return null;
}
 
开发者ID:onprom,项目名称:onprom,代码行数:12,代码来源:OnpromToolkit.java

示例6: convertLog

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
public String convertLog(String path) throws IOException {
    String args[] = {
            "-i", path,
            "-outputValueUnitRatio", unitRatio,
            "-csv"
    };

    String csvFile = FilenameUtils.removeExtension(path) + ".csv";
    PrintStream oldOut = System.out;

    try (FileOutputStream fileStream = new FileOutputStream(csvFile)) {
        PrintStream newOutStream = new PrintStream(fileStream);

        /*
         * By default it prints on stdout. Since it does not seem to provide an easy
         * way to save to a file via API, then just replace the stdout for saving the
         * CSV data.
         */

        System.setOut(newOutStream);

        HistogramLogProcessor processor = new HistogramLogProcessor(args);
        processor.run();

        /*
         * Restore it after use
         */

    } finally {
        System.setOut(oldOut);
    }


    return csvFile;
}
 
开发者ID:orpiske,项目名称:hdr-histogram-plotter,代码行数:36,代码来源:HdrLogProcessorWrapper.java

示例7: loadSatelliteImages

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
private void loadSatelliteImages(PhotoLocationExercise exercise, Path exercisePath, Boolean dryRun) throws IOException, BuenOjoCSVParserException, InvalidSatelliteImageType, BuenOjoFileException, BuenOjoInconsistencyException, BuenOjoDataSetException{
	List<Path> satelliteImagePaths = Files.walk(exercisePath, 1, FileVisitOption.FOLLOW_LINKS).filter(p -> {
		Optional<String> type = BuenOjoFileUtils.contentType(p);
		return type.isPresent() && type.get() != "text/csv";
	}).collect(Collectors.toList());
	
	List<SatelliteImage> satelliteImages = new ArrayList<>();
	for (Path path : satelliteImagePaths) {
		String filename = FilenameUtils.removeExtension(path.getFileName().toString());
		Path csv = path.resolveSibling(filename+".csv");
		SatelliteImage s = satelliteImageFactory.imageFromFile(BuenOjoFileUtils.multipartFile(path), BuenOjoFileUtils.multipartFile(csv), dryRun);
		satelliteImages.add(s);
	}
	satelliteImageRepository.save(satelliteImages);
	
	List<PhotoLocationSatelliteImage> pImages = new ArrayList<>();
	
	for (SatelliteImage satelliteImage : satelliteImages) {
		PhotoLocationSatelliteImage pImg = PhotoLocationSatelliteImage.fromSatelliteImage(satelliteImage);
		pImg.setKeywords(exercise.getLandscapeKeywords());
		pImages.add(pImg);
		
	}
	
	photoLocationSatelliteImageRepository.save(pImages);
	
	exercise.setSatelliteImages(new HashSet<>(pImages));
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:29,代码来源:PhotoLocationLoader.java

示例8: createDefaultImageFile

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
/**
 * This method will return default image when visitor image in not available.
 * 
 * @throws IOException 
 * @return file
 */
public static File createDefaultImageFile(Resource resource, String path) throws IOException {
	String fileNameWithOutExt = FilenameUtils.removeExtension(path);
	InputStream inputStream = resource.getInputStream();
	File tempFile = File.createTempFile(fileNameWithOutExt, "."+FilenameUtils.getExtension(path));
	FileUtils.copyInputStreamToFile(inputStream, tempFile);
	return tempFile;
}
 
开发者ID:Zymr,项目名称:visitormanagement,代码行数:14,代码来源:Util.java

示例9: doUnpack

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
private void doUnpack(final String hostName, final String destPath) {
    try {
        binaryDistributionService.distributeUnzip(hostName);
        final String zipDestinationOption = FilenameUtils.removeExtension(destPath);
        LOGGER.debug("checking if unpacked destination exists: {}", zipDestinationOption);
        binaryDistributionService.remoteFileCheck(hostName, zipDestinationOption);
        binaryDistributionService.backupFile(hostName, zipDestinationOption);
        binaryDistributionService.remoteUnzipBinary(hostName, destPath, zipDestinationOption, "");
    } catch (CommandFailureException e) {
        LOGGER.error("Failed to execute remote command when unpack to {} ", destPath, e);
        throw new ApplicationException("Failed to execute remote command when unpack to  " + destPath, e);
    }
}
 
开发者ID:cerner,项目名称:jwala,代码行数:14,代码来源:ResourceServiceImpl.java

示例10: FSScanPosWrite

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
private void FSScanPosWrite() {
    try {
        Logger.getRootLogger().debug("Writing ScanPos to file:" + FilenameUtils.removeExtension(filename) + ".ScanPosFS..");
        FileOutputStream fout = new FileOutputStream(FilenameUtils.removeExtension(filename) + ".ScanPosFS", false);
        FSTObjectOutput oos = new FSTObjectOutput(fout);
        oos.writeObject(ScanIndex);
        oos.close();
        fout.close();
    } catch (Exception ex) {
        Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
    }
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:13,代码来源:mzXMLParser.java

示例11: writeBackupZipFile

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
public File writeBackupZipFile(String filePath) throws IOException {
    File backupZipFile = new File(FilenameUtils.removeExtension(filePath) + BackupFileService.EXT_ZIP_BACKUP);
    FileUtils.writeByteArrayToFile(backupZipFile, dbData);
    return backupZipFile;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:6,代码来源:BackupData.java

示例12: main

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
public static void main(String[] args) {
    processCommand(args);

    try {
        // HDR Converter
        HdrLogProcessorWrapper processorWrapper;

        processorWrapper = new HdrLogProcessorWrapper(unitRate);

        String csvFile = processorWrapper.convertLog(fileName);

        // CSV Reader
        HdrReader reader = new HdrReader();

        HdrData hdrData = reader.read(csvFile);

        // HdrPlotter
        HdrPlotter plotter = new HdrPlotter(FilenameUtils.removeExtension(fileName), timeUnit);
        plotter.plot(hdrData.getPercentile(), hdrData.getValue());

        HdrPropertyWriter.writeFrom(fileName);

        System.exit(0);
    } catch (Exception e) {
        e.printStackTrace();
        System.err.println(e.getMessage());
    }

    System.exit(1);
}
 
开发者ID:orpiske,项目名称:hdr-histogram-plotter,代码行数:31,代码来源:Main.java

示例13: map

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
public File map(File sourceFile) {
    final String baseName = FilenameUtils.removeExtension(sourceFile.getName());
    String compactMD5 = HashUtil.createCompactMD5(sourceFile.getAbsolutePath());
    File hashDirectory = new File(outputBaseFolder, compactMD5);
    return new File(hashDirectory, baseName + objectFileNameSuffix);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:7,代码来源:CompilerOutputFileNamingScheme.java

示例14: hiResFilenameForImageResource

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
private String hiResFilenameForImageResource(ImageResource imageResource){
	String fileExtension = BuenOjoFileUtils.extensionFromContentType(imageResource.getHiResImageContentType());
	String fileName = FilenameUtils.removeExtension(imageResource.getName()) + BuenOjoFileUtils.HI_RES_SUFFIX +FilenameUtils.EXTENSION_SEPARATOR_STR +fileExtension;
	return fileName;
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:6,代码来源:ImageResourceService.java

示例15: loResFilenameForImageResource

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
private String loResFilenameForImageResource(ImageResource imageResource){
	String fileExtension = BuenOjoFileUtils.extensionFromContentType(imageResource.getLoResImageContentType());
	String fileName = FilenameUtils.removeExtension(imageResource.getName()) +FilenameUtils.EXTENSION_SEPARATOR_STR +fileExtension;
	return fileName;
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:6,代码来源:ImageResourceService.java


注:本文中的org.apache.commons.io.FilenameUtils.removeExtension方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。