本文整理了Java中net.sf.okapi.common.Util.getFilename()
方法的一些代码示例,展示了Util.getFilename()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.getFilename()
方法的具体详情如下:
包路径:net.sf.okapi.common.Util
类名称:Util
方法名:getFilename
[英]Gets the filename of a path.
[中]获取路径的文件名。
代码示例来源:origin: net.sf.okapi.lib/okapi-lib-segmentation-ui
protected String updateCaption_getFileName(String srxPath) {
return Util.getFilename(srxPath, true);
}
代码示例来源:origin: net.sf.okapi.lib/okapi-lib-verification-ui
private void updateCaption () {
String filename;
if ( qcsPath != null ) {
filename = Util.getFilename(qcsPath, true);
}
else {
filename = "Untitled";
}
String text = "CheckMate";
shell.setText(filename + " - " + text); //$NON-NLS-1$
}
代码示例来源:origin: net.sf.okapi.tm/okapi-tm-simpletm
public void open (String path) {
try {
close();
String pathNoExt = path;
if ( pathNoExt.endsWith(DATAFILE_EXT) ) {
pathNoExt = pathNoExt.substring(0, pathNoExt.length()-DATAFILE_EXT.length());
}
if ( !(new File(pathNoExt+DATAFILE_EXT)).exists() ) return;
conn = DriverManager.getConnection("jdbc:h2:"+pathNoExt, "sa", "");
origin = Util.getFilename(path, true);
}
catch ( SQLException e ) {
throw new OkapiException(e);
}
}
代码示例来源:origin: net.sf.okapi/okapi-core
/**
* Updates the custom configurations for this mapper. This should
* be called if the custom configurations directory has changed.
*/
public void updateCustomConfigurations () {
File dir = new File(customParmsDir);
String res[] = dir.list(new DefaultFilenameFilter(CONFIGFILE_EXT));
clearConfigurations(true); // Only custom configurations
if ( res == null ) return;
for ( int i=0; i<res.length; i++ ) {
addCustomConfiguration(Util.getFilename(res[i], false));
}
}
代码示例来源:origin: net.sf.okapi.lib/okapi-lib-segmentation-ui
private String makeNonHtmlOutputPath (String inputPath) {
if ( inputPath.length() == 0 ) return ""; //$NON-NLS-1$
String ext = Util.getExtension(inputPath);
String filename = Util.getFilename(inputPath, false);
return Util.getDirectoryName(inputPath) + File.separator +
filename + Res.getString("testFileDlg.outputExtension") + ext; //$NON-NLS-1$
}
代码示例来源:origin: net.sf.okapi.steps/okapi-step-generatesimpletm
@Override
protected Event handleStartDocument (Event event) {
StartDocument sd = (StartDocument)event.getResource();
fileName = Util.getFilename(sd.getName(), true);
isMultilingual = sd.isMultilingual();
if(!isMultilingual){
logger.warn("File {} is not processed as a multiLingual file and cannot be used to populate the SimpleTm.", fileName);
}
return event;
}
代码示例来源:origin: net.sf.okapi.steps/okapi-step-leveraging
private XMLWriter startTemporaryFiles () {
// Create the HTML source file
XMLWriter htmlWriter = new XMLWriter(htmlSourceFile.getPath());
// Start building the source file
htmlWriter.writeStartElement("html");
htmlWriter.writeStartElement("meta");
htmlWriter.writeAttributeString("http-equiv", "Content-Type");
htmlWriter.writeAttributeString("content", "text/html; charset=UTF-8");
htmlWriter.writeEndElementLineBreak();
// Set the output name and make sure it's deleted
String path = htmlSourceFile.getAbsolutePath();
path = Util.getDirectoryName(path) + File.separator + Util.getFilename(path, false) + ".trg.html";
htmlTargetFile = new File(path);
if ( htmlTargetFile.exists() ) {
htmlTargetFile.delete();
}
// Create the store for the original source
path = htmlSourceFile.getAbsolutePath();
path = Util.getDirectoryName(path) + File.separator + Util.getFilename(path, false) + ".ori.bin";
originalStoreFile = new File(path);
store.create(originalStoreFile);
return htmlWriter;
}
代码示例来源:origin: net.sf.okapi.tm/okapi-tm-simpletm
origin = Util.getFilename(path, true);
代码示例来源:origin: net.sf.okapi/okapi-core
/**
* Detects if a given string matches a given pattern (not necessarily a regex), possibly containing wildcards
* @param string the given string (no-wildcards)
* @param pattern the pattern containing wildcards to match against
* @param filenameMode indicates if the given string should be considered a file name
* @return true if the given string matches the given pattern
*/
public static boolean matchesWildcard(String string, String pattern, boolean filenameMode) {
if (filenameMode) {
String filename = Util.getFilename(string, true);
String patternFilename = Util.getFilename(pattern, true);
String filePath = Util.getDirectoryName(string);
String patternFilePath = Util.getDirectoryName(pattern);
boolean pathMatches;
if (Util.isEmpty(patternFilePath))
pathMatches = true; // word/settings/filename.ext matches *.ext
else
pathMatches = Pattern.matches(normalizeWildcards(patternFilePath), filePath); // word/settings/filename.ext matches word/*/*.ext
boolean filenameMatches = Pattern.matches(normalizeWildcards(patternFilename), filename);
return pathMatches && filenameMatches;
}
return Pattern.matches(normalizeWildcards(pattern), string);
}
代码示例来源:origin: net.sf.okapi.steps/okapi-step-ttxsplitter
String path = new File(uri).getAbsolutePath();
String fname = Util.getFilename(path, false);
int p = fname.lastIndexOf('_');
if ( p == -1 ) {
代码示例来源:origin: net.sf.okapi.steps/okapi-step-gttbatchtranslation
for ( File inputFile : blocks ) {
String docId = gtt.uploadDocument(inputFile.getPath(),
Util.getFilename(inputFile.getPath(), true), tmId);
if ( docId == null ) {
throw new OkapiException(String.format("Could not upload block %s.", inputFile.getPath()));
代码示例来源:origin: net.sf.okapi.steps/okapi-step-rainbowkit
if ( tmxWriterApproved != null ) {
if ( tmxWriterApproved.getItemCount() > 0 ) {
tms.add(Util.getFilename(tmxPathApproved, true));
tms.add(Util.getFilename(tmxPathAlternates, true));
tms.add(Util.getFilename(tmxPathLeverage, true));
tms.add(Util.getFilename(tmxPathUnApproved, true));
代码示例来源:origin: net.sf.okapi.filters/okapi-filter-mosestext
+ Util.getFilename(srcOutputPath, false)
+ "."
+ trgLoc.toString();
代码示例来源:origin: net.sf.okapi/okapi-core
/**
* Adds to a given {@link FilterConfigurationMapper} object the custom configuration
* defined in the fprm file denoted by a given URL.
* @param fcMapper the given {@link FilterConfigurationMapper}.
* @param customConfig the URL of a fprm file defining the custom configuration
* the filter should be loaded from. The file extension should be .fprm.
* The file name should follow the pattern of custom filter configurations,
* i.e. contain a filter name like "okf_xmlstream@custom_config.fprm".
* @return the configuration identifier or null if the configuration was not added.
*/
public static String addCustomConfig(FilterConfigurationMapper fcMapper,
URL customConfig) {
String configId = null;
try {
String path = customConfig.toURI().getPath();
String root = Util.getDirectoryName(path) + File.separator;
configId = Util.getFilename(path, false);
fcMapper.setCustomConfigurationsDirectory(root);
fcMapper.addCustomConfiguration(configId);
fcMapper.updateCustomConfigurations();
} catch (URISyntaxException e) {
throw new OkapiIOException(e);
}
return configId;
}
代码示例来源:origin: net.sf.okapi.steps/okapi-step-rainbowkit
origin = LocaleId.replaceVariables(origin, manifest.getSourceLocale(), manifest.getTargetLocale());
String pattern = Util.getFilename(origin, true);
String origDir = Util.getDirectoryName(origin);
String origFn = Util.getFilename(file.getAbsolutePath(), true);
String destFn = Util.getFilename(destination, true);
if ( destFn.equalsIgnoreCase(Parameters.SUPPORTFILE_SAMENAME) ) {
destFn = origFn;
代码示例来源:origin: net.sf.okapi.steps/okapi-step-xsltransform
outFile = new File(outFile, Util.getFilename(rawDoc.getInputURI().getPath(), true));
代码示例来源:origin: net.sf.okapi.steps/okapi-step-rainbowkit
private String makeTargetPath (MergingInfo item) {
String ex = Util.getExtension(item.getRelativeInputPath());
String sd = Util.getDirectoryName(item.getRelativeInputPath());
String fn = Util.getFilename(item.getRelativeInputPath(), false);
return manifest.getTempSourceDirectory()
+ ( sd.isEmpty() ? "" : sd + "/" )
+ fn + "_" + manifest.getTargetLocale().toPOSIXLocaleId()
+ ex + ".po";
}
代码示例来源:origin: net.sf.okapi.lib/okapi-lib-verification-ui
outEncoding = rawDoc.getEncoding();
outPath = new File(rawDoc.getInputURI()).getPath();
outPath = Util.getDirectoryName(outPath) + File.separator + Util.getFilename(outPath, false) + ".out" + Util.getExtension(outPath);
writer = sd.getFilterWriter();
writer.setOptions(trgLoc, outEncoding);
代码示例来源:origin: net.sf.okapi.steps/okapi-step-rainbowkit
String resourceFile = Util.getFilename(poPath, true);
String subdir = Util.getDirectoryName(info.getRelativeInputPath());
if ( !subdir.isEmpty() ) {
内容来源于网络,如有侵权,请联系作者删除!