當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。