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


Java FilenameUtils.getBaseName方法代码示例

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


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

示例1: buildURI

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
private String buildURI(final File sourceFile) {
	String uri = FileUtil.asPath(sourceFile.getPath()).replace(FileUtil.asPath( contentPath), "");

	boolean noExtensionUri = config.getBoolean(Keys.URI_NO_EXTENSION);
	String noExtensionUriPrefix = config.getString(Keys.URI_NO_EXTENSION_PREFIX);
	if (noExtensionUri && noExtensionUriPrefix != null && noExtensionUriPrefix.length() > 0) {
    	// convert URI from xxx.html to xxx/index.html
		if (uri.startsWith(noExtensionUriPrefix)) {
			uri = "/" + FilenameUtils.getPath(uri) + FilenameUtils.getBaseName(uri) + "/index" + config.getString(Keys.OUTPUT_EXTENSION);
		}
    } else {
        uri = uri.substring(0, uri.lastIndexOf(".")) + config.getString(Keys.OUTPUT_EXTENSION);
    }

    // strip off leading / to enable generating non-root based sites
	if (uri.startsWith("/")) {
		uri = uri.substring(1, uri.length());
	}
    return uri;
}
 
开发者ID:ghaseminya,项目名称:jbake-rtl-jalaali,代码行数:21,代码来源:Crawler.java

示例2: JavaSerializationPeakClusterRead

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
private boolean JavaSerializationPeakClusterRead() {
    if (!new File(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_PeakCluster.ser").exists()) {
        return false;
    }
    try {
        Logger.getRootLogger().info("Reading PeakCluster serialization from file:" + FilenameUtils.getBaseName(ScanCollectionName) + "_PeakCluster.ser...");

        FileInputStream fileIn = new FileInputStream(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_PeakCluster.ser");
        ObjectInputStream in = new ObjectInputStream(fileIn);
        PeakClusters = (ArrayList<PeakCluster>) in.readObject();
        in.close();
        fileIn.close();
    } catch (Exception ex) {
        Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
        return false;
    }
    return true;
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:19,代码来源:LCMSPeakBase.java

示例3: FasterSerialzationRead

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
public static FastaParser FasterSerialzationRead(String Filename) throws FileNotFoundException {

        if (!new File(FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename) + ".FastaSer").exists()) {
            return null;
        }
        FastaParser fastareader = null;
        try {
            org.apache.log4j.Logger.getRootLogger().info("Loading fasta serialization to file:" + FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename) + ".FastaSer..");
            FileInputStream fileIn = new FileInputStream(FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename) + ".FastaSer");
            FSTObjectInput in = new FSTObjectInput(fileIn);
            fastareader = (FastaParser) in.readObject();
            in.close();
            fileIn.close();
        } catch (Exception ex) {
            org.apache.log4j.Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
            return null;
        }

        return fastareader;
    }
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:21,代码来源:FastaParser.java

示例4: getOutputFile

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
private static File getOutputFile(String extension) {
    outputFilename = args.HasOption("output-file") ? 
            args.GetOption("output-file") : 
            FilenameUtils.getBaseName(args.GetOption("access-file")) + "." + extension;
    
    File outFile = new File(FilenameUtils.concat(FilenameUtils.getFullPath(args.GetOption("access-file")), outputFilename));
    if(outFile.exists()) {
        try {
            outFile.delete();
        } catch(SecurityException e) {
            Error(String.format("Could not delete existing output file '%s'", outputFilename));
            return null;
        }
    }
    
    return outFile;
}
 
开发者ID:clytras,项目名称:AccessConverter,代码行数:18,代码来源:AccessConverter.java

示例5: createSuffixUrl

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
private String createSuffixUrl(String inputUrl, String suffix) {
    String outputUrl = "";

    if(suffix.equals(STREAM)) {
        if (inputUrl.endsWith(VIDEO_EXTENSION)) {
            String name = FilenameUtils.getBaseName(inputUrl);
            String outName = name.replace(VIDEO_EXTENSION, "");
            outName = outName + '/' + STREAM;
            outputUrl = inputUrl.replace(name + VIDEO_EXTENSION, outName);
        }
    } else {
        if (inputUrl.endsWith(VIDEO_EXTENSION)) {
            outputUrl = inputUrl.replace(VIDEO_EXTENSION, suffix + VIDEO_EXTENSION);
        }
    }

    return outputUrl;
}
 
开发者ID:webinerds,项目名称:s3-proxy-chunk-upload,代码行数:19,代码来源:VideoConverter.java

示例6: ReadParametersSerialization

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
public static InstrumentParameter ReadParametersSerialization(String filepath) {
    if (!new File(FilenameUtils.getFullPath(filepath) + FilenameUtils.getBaseName(filepath) + "_params.ser").exists()) {
        return null;
    }
    try {
        Logger.getRootLogger().info("Reading parameters from file:" + FilenameUtils.getFullPath(filepath) + FilenameUtils.getBaseName(filepath) + "_params.ser...");

        FileInputStream fileIn = new FileInputStream(FilenameUtils.getFullPath(filepath) + FilenameUtils.getBaseName(filepath) + "_params.ser");
        ObjectInputStream in = new ObjectInputStream(fileIn);
        InstrumentParameter params = (InstrumentParameter) in.readObject();
        in.close();
        fileIn.close();
        return params;

    } catch (Exception ex) {
        Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
        return null;
    }
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:20,代码来源:InstrumentParameter.java

示例7: FSCluster2CurveRead

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
private boolean FSCluster2CurveRead() {
    if (!new File(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_Clus2Cur.serFS").exists()) {
        return false;
    }
    try {
        Logger.getRootLogger().debug("Reading PrecursorFragmentCorr serialization from file:" + FilenameUtils.getBaseName(ScanCollectionName) + "_Clus2Cur.serFS...");
        FileInputStream fileIn = new FileInputStream(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_Clus2Cur.serFS");
        FSTObjectInput in = new FSTObjectInput(fileIn);
        FragmentsClu2Cur = (HashMap<Integer, ArrayList<PrecursorFragmentPairEdge>>) in.readObject();
        in.close();
        fileIn.close();

    } catch (Exception ex) {
        Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
        return false;
    }
    return true;
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:19,代码来源:LCMSPeakDIAMS2.java

示例8: FS_PeakClusterRead

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
private boolean FS_PeakClusterRead() {
    if (!new File(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_PeakCluster.serFS").exists()) {
        return false;
    }
    try {
        Logger.getRootLogger().info("Reading PeakCluster serialization from file:" + FilenameUtils.getBaseName(ScanCollectionName) + "_PeakCluster.serFS...");

        FileInputStream fileIn = new FileInputStream(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_PeakCluster.serFS");
        FSTObjectInput in = new FSTObjectInput(fileIn);
        PeakClusters = (ArrayList<PeakCluster>) in.readObject();
        in.close();
        fileIn.close();
    } catch (Exception ex) {
        Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
        if (FS_PeakClusterRead_Old()) {
            WritePeakClusterSerialization();
            return true;
        }
        Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
        return false;
    }
    return true;
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:24,代码来源:LCMSPeakBase.java

示例9: FS_PeakClusterWrite

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
private void FS_PeakClusterWrite() {
    try {
        Logger.getRootLogger().info("Writing PeakCluster serialization to file:" + FilenameUtils.getBaseName(ScanCollectionName) + "_PeakCluster.serFS...");
        FileOutputStream fout = new FileOutputStream(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_PeakCluster.serFS", false);
        FSTObjectOutput out = new FSTObjectOutput(fout);
        out.writeObject(PeakClusters);
        out.close();
        fout.close();
    } catch (Exception ex) {
        Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
        JavaSerializationPeakClusterWrite();
    }
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:14,代码来源:LCMSPeakBase.java

示例10: FSCluster2CurveUnfragWrite

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
private void FSCluster2CurveUnfragWrite() {
    try {
        Logger.getRootLogger().debug("Writing UnfragPrecursorFragCorr serialization to file:" + FilenameUtils.getBaseName(ScanCollectionName) + "_UnfClus2Cur.serFS...");
        FileOutputStream fout = new FileOutputStream(FilenameUtils.getFullPath(ParentmzXMLName) + FilenameUtils.getBaseName(ParentmzXMLName) + "_Peak/" + FilenameUtils.getBaseName(ScanCollectionName) + "_UnfClus2Cur.serFS", false);
        FSTObjectOutput oos = new FSTObjectOutput(fout);
        oos.writeObject(UnFragIonClu2Cur);
        oos.close();
        fout.close();
    } catch (Exception ex) {
        Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
    }
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:13,代码来源:LCMSPeakDIAMS2.java

示例11: saveParsedText

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
@Override
public File saveParsedText(String path, File file, String text) {
    String filename = FilenameUtils.getBaseName(file.getName()) + EXTENSION;
    createDirectory(CommonUtils.TMP_FILES_PATH);
    String tmpFile = String.join(CommonUtils.DELIMITER, path, filename);
    try {
        FileWriter fileWriter = new FileWriter(tmpFile);
        fileWriter.write(text);
        fileWriter.flush();
        fileWriter.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return new File(tmpFile);
}
 
开发者ID:victorward,项目名称:recruitervision,代码行数:16,代码来源:FileServiceImpl.java

示例12: ExportPepPSMCSV

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
private void ExportPepPSMCSV(String folder) throws IOException {
    if (folder == null | "".equals(folder)) {
        folder = FilenameUtils.getFullPath(mzXMLFileName);
    }
    Logger.getRootLogger().info("Writing PSM result to file:" + folder + FilenameUtils.getBaseName(mzXMLFileName) + "_PSMs.csv...");
    FileWriter writer = new FileWriter(folder + FilenameUtils.getBaseName(mzXMLFileName) + "_PSMs.csv");
    writer.write("SpecID,Sequence,ModSeq,TPPModSeq,Modification,Charge,mz,NeutralPepMass,ObservedMass,RT,AdjustedRT,Rank,ScanNo,PreAA,NextAA,MissedCleavage,ExpectValue,MassError,Prob,Rawname,ParentPepIndex,MS1Quant\n");
    for (PepIonID pepion : PepIonList.values()) {
        for (PSM psm : pepion.GetPSMList()) {
            writer.write(psm.SpecNumber + "," + psm.Sequence + "," + psm.ModSeq + "," + psm.TPPModSeq + "," + psm.GetModificationString() + "," + psm.Charge + "," + psm.ObserPrecursorMz() + "," + psm.NeutralPepMass + "," + psm.ObserPrecursorMass + "," + psm.RetentionTime + "," + psm.NeighborMaxRetentionTime + "," + psm.Rank + "," + psm.ScanNo + "," + psm.PreAA + "," + psm.NextAA + "," + psm.MissedCleavage + "," + psm.expect + "," + psm.MassError + "," + psm.Probability + "," + psm.RawDataName + "," + pepion.Index + "," + pepion.GetMS1() + "\n");
        }
    }
    writer.close();
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:15,代码来源:LCMSID.java

示例13: handlePost

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
@RequestMapping(method = RequestMethod.POST)
protected String handlePost(RedirectAttributes redirectAttributes,
                                       HttpServletRequest request
                                       ) throws Exception {
    Map<String, Object> map = new HashMap<String, Object>();

    try {
        if (ServletFileUpload.isMultipartContent(request)) {

            FileItemFactory factory = new DiskFileItemFactory();
            ServletFileUpload upload = new ServletFileUpload(factory);
            List<?> items = upload.parseRequest(request);
            for (Object o : items) {
                FileItem item = (FileItem) o;

                if ("file".equals(item.getFieldName()) && !StringUtils.isBlank(item.getName())) {
                    if (item.getSize() > MAX_PLAYLIST_SIZE_MB * 1024L * 1024L) {
                        throw new Exception("The playlist file is too large. Max file size is " + MAX_PLAYLIST_SIZE_MB + " MB.");
                    }
                    String playlistName = FilenameUtils.getBaseName(item.getName());
                    String fileName = FilenameUtils.getName(item.getName());
                    String format = StringUtils.lowerCase(FilenameUtils.getExtension(item.getName()));
                    String username = securityService.getCurrentUsername(request);
                    Playlist playlist = playlistService.importPlaylist(username, playlistName, fileName,
                                                                       item.getInputStream(), null);
                    map.put("playlist", playlist);
                }
            }
        }
    } catch (Exception e) {
        map.put("error", e.getMessage());
    }

    redirectAttributes.addFlashAttribute("model", map);
    return "redirect:importPlaylist";
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:37,代码来源:ImportPlaylistController.java

示例14: generateChannelApk

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
private void generateChannelApk(final File inputFile, final File outputDir, final String channel, final String alias, final Map<String, String> extraInfo) {
    final String channelName = alias == null ? channel : alias;
    final String name = FilenameUtils.getBaseName(inputFile.getName());
    final String extension = FilenameUtils.getExtension(inputFile.getName());
    final String newName = name + "_" + channelName + "." + extension;
    final File channelApk = new File(outputDir, newName);
    try {
        FileUtils.copyFile(inputFile, channelApk);
        ChannelWriter.put(channelApk, channel, extraInfo);
    } catch (IOException | SignatureNotFoundException e) {
        e.printStackTrace();
    }
}
 
开发者ID:Meituan-Dianping,项目名称:walle,代码行数:14,代码来源:Batch2Command.java

示例15: LibraryMatchWrite

import org.apache.commons.io.FilenameUtils; //导入方法依赖的package包/类
public boolean LibraryMatchWrite() throws FileNotFoundException {
    try {
        Logger.getRootLogger().info("Writing Target match results to file:" + FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename) + "_" + LibID + "_LibMatch.serFS...");
        FileOutputStream fout = new FileOutputStream(FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename) + "_" + LibID + "_LibMatch.serFS", false);
        FSTObjectOutput out = new FSTObjectOutput(fout);
        out.writeObject(this);
        out.close();
        fout.close();
    } catch (Exception ex) {
        Logger.getRootLogger().error(ExceptionUtils.getStackTrace(ex));
        return false;
    }
    return true;
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:15,代码来源:TargetMatchScoring.java


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