net.sf.okapi.common.Util.getFilename()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(222)

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

Util.getFilename介绍

[英]Gets the filename of a path.
[中]获取路径的文件名。

代码示例

代码示例来源:origin: net.sf.okapi.lib/okapi-lib-segmentation-ui

  1. protected String updateCaption_getFileName(String srxPath) {
  2. return Util.getFilename(srxPath, true);
  3. }

代码示例来源:origin: net.sf.okapi.lib/okapi-lib-verification-ui

  1. private void updateCaption () {
  2. String filename;
  3. if ( qcsPath != null ) {
  4. filename = Util.getFilename(qcsPath, true);
  5. }
  6. else {
  7. filename = "Untitled";
  8. }
  9. String text = "CheckMate";
  10. shell.setText(filename + " - " + text); //$NON-NLS-1$
  11. }

代码示例来源:origin: net.sf.okapi.tm/okapi-tm-simpletm

  1. public void open (String path) {
  2. try {
  3. close();
  4. String pathNoExt = path;
  5. if ( pathNoExt.endsWith(DATAFILE_EXT) ) {
  6. pathNoExt = pathNoExt.substring(0, pathNoExt.length()-DATAFILE_EXT.length());
  7. }
  8. if ( !(new File(pathNoExt+DATAFILE_EXT)).exists() ) return;
  9. conn = DriverManager.getConnection("jdbc:h2:"+pathNoExt, "sa", "");
  10. origin = Util.getFilename(path, true);
  11. }
  12. catch ( SQLException e ) {
  13. throw new OkapiException(e);
  14. }
  15. }

代码示例来源:origin: net.sf.okapi/okapi-core

  1. /**
  2. * Updates the custom configurations for this mapper. This should
  3. * be called if the custom configurations directory has changed.
  4. */
  5. public void updateCustomConfigurations () {
  6. File dir = new File(customParmsDir);
  7. String res[] = dir.list(new DefaultFilenameFilter(CONFIGFILE_EXT));
  8. clearConfigurations(true); // Only custom configurations
  9. if ( res == null ) return;
  10. for ( int i=0; i<res.length; i++ ) {
  11. addCustomConfiguration(Util.getFilename(res[i], false));
  12. }
  13. }

代码示例来源:origin: net.sf.okapi.lib/okapi-lib-segmentation-ui

  1. private String makeNonHtmlOutputPath (String inputPath) {
  2. if ( inputPath.length() == 0 ) return ""; //$NON-NLS-1$
  3. String ext = Util.getExtension(inputPath);
  4. String filename = Util.getFilename(inputPath, false);
  5. return Util.getDirectoryName(inputPath) + File.separator +
  6. filename + Res.getString("testFileDlg.outputExtension") + ext; //$NON-NLS-1$
  7. }

代码示例来源:origin: net.sf.okapi.steps/okapi-step-generatesimpletm

  1. @Override
  2. protected Event handleStartDocument (Event event) {
  3. StartDocument sd = (StartDocument)event.getResource();
  4. fileName = Util.getFilename(sd.getName(), true);
  5. isMultilingual = sd.isMultilingual();
  6. if(!isMultilingual){
  7. logger.warn("File {} is not processed as a multiLingual file and cannot be used to populate the SimpleTm.", fileName);
  8. }
  9. return event;
  10. }

代码示例来源:origin: net.sf.okapi.steps/okapi-step-leveraging

  1. private XMLWriter startTemporaryFiles () {
  2. // Create the HTML source file
  3. XMLWriter htmlWriter = new XMLWriter(htmlSourceFile.getPath());
  4. // Start building the source file
  5. htmlWriter.writeStartElement("html");
  6. htmlWriter.writeStartElement("meta");
  7. htmlWriter.writeAttributeString("http-equiv", "Content-Type");
  8. htmlWriter.writeAttributeString("content", "text/html; charset=UTF-8");
  9. htmlWriter.writeEndElementLineBreak();
  10. // Set the output name and make sure it's deleted
  11. String path = htmlSourceFile.getAbsolutePath();
  12. path = Util.getDirectoryName(path) + File.separator + Util.getFilename(path, false) + ".trg.html";
  13. htmlTargetFile = new File(path);
  14. if ( htmlTargetFile.exists() ) {
  15. htmlTargetFile.delete();
  16. }
  17. // Create the store for the original source
  18. path = htmlSourceFile.getAbsolutePath();
  19. path = Util.getDirectoryName(path) + File.separator + Util.getFilename(path, false) + ".ori.bin";
  20. originalStoreFile = new File(path);
  21. store.create(originalStoreFile);
  22. return htmlWriter;
  23. }

代码示例来源:origin: net.sf.okapi.tm/okapi-tm-simpletm

  1. origin = Util.getFilename(path, true);

代码示例来源:origin: net.sf.okapi/okapi-core

  1. /**
  2. * Detects if a given string matches a given pattern (not necessarily a regex), possibly containing wildcards
  3. * @param string the given string (no-wildcards)
  4. * @param pattern the pattern containing wildcards to match against
  5. * @param filenameMode indicates if the given string should be considered a file name
  6. * @return true if the given string matches the given pattern
  7. */
  8. public static boolean matchesWildcard(String string, String pattern, boolean filenameMode) {
  9. if (filenameMode) {
  10. String filename = Util.getFilename(string, true);
  11. String patternFilename = Util.getFilename(pattern, true);
  12. String filePath = Util.getDirectoryName(string);
  13. String patternFilePath = Util.getDirectoryName(pattern);
  14. boolean pathMatches;
  15. if (Util.isEmpty(patternFilePath))
  16. pathMatches = true; // word/settings/filename.ext matches *.ext
  17. else
  18. pathMatches = Pattern.matches(normalizeWildcards(patternFilePath), filePath); // word/settings/filename.ext matches word/*/*.ext
  19. boolean filenameMatches = Pattern.matches(normalizeWildcards(patternFilename), filename);
  20. return pathMatches && filenameMatches;
  21. }
  22. return Pattern.matches(normalizeWildcards(pattern), string);
  23. }

代码示例来源:origin: net.sf.okapi.steps/okapi-step-ttxsplitter

  1. String path = new File(uri).getAbsolutePath();
  2. String fname = Util.getFilename(path, false);
  3. int p = fname.lastIndexOf('_');
  4. if ( p == -1 ) {

代码示例来源:origin: net.sf.okapi.steps/okapi-step-gttbatchtranslation

  1. for ( File inputFile : blocks ) {
  2. String docId = gtt.uploadDocument(inputFile.getPath(),
  3. Util.getFilename(inputFile.getPath(), true), tmId);
  4. if ( docId == null ) {
  5. throw new OkapiException(String.format("Could not upload block %s.", inputFile.getPath()));

代码示例来源:origin: net.sf.okapi.steps/okapi-step-rainbowkit

  1. if ( tmxWriterApproved != null ) {
  2. if ( tmxWriterApproved.getItemCount() > 0 ) {
  3. tms.add(Util.getFilename(tmxPathApproved, true));
  4. tms.add(Util.getFilename(tmxPathAlternates, true));
  5. tms.add(Util.getFilename(tmxPathLeverage, true));
  6. tms.add(Util.getFilename(tmxPathUnApproved, true));

代码示例来源:origin: net.sf.okapi.filters/okapi-filter-mosestext

  1. + Util.getFilename(srcOutputPath, false)
  2. + "."
  3. + trgLoc.toString();

代码示例来源:origin: net.sf.okapi/okapi-core

  1. /**
  2. * Adds to a given {@link FilterConfigurationMapper} object the custom configuration
  3. * defined in the fprm file denoted by a given URL.
  4. * @param fcMapper the given {@link FilterConfigurationMapper}.
  5. * @param customConfig the URL of a fprm file defining the custom configuration
  6. * the filter should be loaded from. The file extension should be .fprm.
  7. * The file name should follow the pattern of custom filter configurations,
  8. * i.e. contain a filter name like "okf_xmlstream@custom_config.fprm".
  9. * @return the configuration identifier or null if the configuration was not added.
  10. */
  11. public static String addCustomConfig(FilterConfigurationMapper fcMapper,
  12. URL customConfig) {
  13. String configId = null;
  14. try {
  15. String path = customConfig.toURI().getPath();
  16. String root = Util.getDirectoryName(path) + File.separator;
  17. configId = Util.getFilename(path, false);
  18. fcMapper.setCustomConfigurationsDirectory(root);
  19. fcMapper.addCustomConfiguration(configId);
  20. fcMapper.updateCustomConfigurations();
  21. } catch (URISyntaxException e) {
  22. throw new OkapiIOException(e);
  23. }
  24. return configId;
  25. }

代码示例来源:origin: net.sf.okapi.steps/okapi-step-rainbowkit

  1. origin = LocaleId.replaceVariables(origin, manifest.getSourceLocale(), manifest.getTargetLocale());
  2. String pattern = Util.getFilename(origin, true);
  3. String origDir = Util.getDirectoryName(origin);
  4. String origFn = Util.getFilename(file.getAbsolutePath(), true);
  5. String destFn = Util.getFilename(destination, true);
  6. if ( destFn.equalsIgnoreCase(Parameters.SUPPORTFILE_SAMENAME) ) {
  7. destFn = origFn;

代码示例来源:origin: net.sf.okapi.steps/okapi-step-xsltransform

  1. outFile = new File(outFile, Util.getFilename(rawDoc.getInputURI().getPath(), true));

代码示例来源:origin: net.sf.okapi.steps/okapi-step-rainbowkit

  1. private String makeTargetPath (MergingInfo item) {
  2. String ex = Util.getExtension(item.getRelativeInputPath());
  3. String sd = Util.getDirectoryName(item.getRelativeInputPath());
  4. String fn = Util.getFilename(item.getRelativeInputPath(), false);
  5. return manifest.getTempSourceDirectory()
  6. + ( sd.isEmpty() ? "" : sd + "/" )
  7. + fn + "_" + manifest.getTargetLocale().toPOSIXLocaleId()
  8. + ex + ".po";
  9. }

代码示例来源:origin: net.sf.okapi.lib/okapi-lib-verification-ui

  1. outEncoding = rawDoc.getEncoding();
  2. outPath = new File(rawDoc.getInputURI()).getPath();
  3. outPath = Util.getDirectoryName(outPath) + File.separator + Util.getFilename(outPath, false) + ".out" + Util.getExtension(outPath);
  4. writer = sd.getFilterWriter();
  5. writer.setOptions(trgLoc, outEncoding);

代码示例来源:origin: net.sf.okapi.steps/okapi-step-rainbowkit

  1. String resourceFile = Util.getFilename(poPath, true);
  2. String subdir = Util.getDirectoryName(info.getRelativeInputPath());
  3. if ( !subdir.isEmpty() ) {

相关文章