本文整理汇总了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;
}
示例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() );
}
}
示例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);
// }
}
示例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);
}
示例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;
}
示例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;
}
示例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));
}
示例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;
}
示例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);
}
}
示例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));
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}