marytts.util.io.FileUtils.delete()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(130)

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

FileUtils.delete介绍

暂无

代码示例

代码示例来源:origin: marytts/marytts

  1. public static void delete(String[] files, boolean bDisplayInfo) {
  2. for (int i = 0; i < files.length; i++) {
  3. delete(files[i], bDisplayInfo);
  4. }
  5. }

代码示例来源:origin: marytts/marytts

  1. public void deleteTemporaryFiles(WeightedCodebookFeatureCollection fcol, BaselineAdaptationSet sourceTrainingSet,
  2. BaselineAdaptationSet targetTrainingSet) {
  3. FileUtils.delete(fcol.indexMapFiles, true);
  4. // FileUtils.delete(sourceTrainingSet.getLsfFiles(), true);
  5. // FileUtils.delete(targetTrainingSet.getLsfFiles(), true);
  6. // FileUtils.delete(sourceTrainingSet.getF0Files(), true);
  7. // FileUtils.delete(targetTrainingSet.getF0Files(), true);
  8. // FileUtils.delete(sourceTrainingSet.getEnergyFiles(), true);
  9. // FileUtils.delete(targetTrainingSet.getEnergyFiles(), true);
  10. FileUtils.delete(wcParams.temporaryCodebookFile);
  11. }
  12. }

代码示例来源:origin: marytts/marytts

  1. public void deleteTemporaryFiles(WeightedCodebookFeatureCollection fcol, BaselineAdaptationSet sourceTrainingSet,
  2. BaselineAdaptationSet targetTrainingSet) {
  3. FileUtils.delete(fcol.indexMapFiles, true);
  4. // FileUtils.delete(sourceTrainingSet.getLsfFiles(), true);
  5. // FileUtils.delete(targetTrainingSet.getLsfFiles(), true);
  6. // FileUtils.delete(sourceTrainingSet.getF0Files(), true);
  7. // FileUtils.delete(targetTrainingSet.getF0Files(), true);
  8. // FileUtils.delete(sourceTrainingSet.getEnergyFiles(), true);
  9. // FileUtils.delete(targetTrainingSet.getEnergyFiles(), true);
  10. FileUtils.delete(wcParams.temporaryCodebookFile);
  11. }
  12. }

代码示例来源:origin: marytts/marytts

  1. public static void delete(String[] files, boolean bDisplayInfo) {
  2. for (int i = 0; i < files.length; i++) {
  3. delete(files[i], bDisplayInfo);
  4. }
  5. }

代码示例来源:origin: marytts/marytts

  1. public static void delete(String[] files) {
  2. delete(files, false);
  3. }

代码示例来源:origin: marytts/marytts

  1. public static void delete(String[] files) {
  2. delete(files, false);
  3. }

代码示例来源:origin: marytts/marytts

  1. public static void delete(String file) {
  2. if (exists(file)) {
  3. delete(file, false);
  4. }
  5. }

代码示例来源:origin: marytts/marytts

  1. public static void delete(String file) {
  2. if (exists(file)) {
  3. delete(file, false);
  4. }
  5. }

代码示例来源:origin: marytts/marytts

  1. private void init(String codebookFile, int desiredStatus) {
  2. status = NOT_OPENED;
  3. stream = null;
  4. currentFile = "";
  5. if (desiredStatus == OPEN_FOR_READ) {
  6. status = desiredStatus;
  7. try {
  8. stream = new MaryRandomAccessFile(codebookFile, "r");
  9. currentFile = codebookFile;
  10. } catch (FileNotFoundException e) {
  11. // TODO Auto-generated catch block
  12. e.printStackTrace();
  13. }
  14. } else if (desiredStatus == OPEN_FOR_WRITE) {
  15. FileUtils.delete(codebookFile);
  16. status = desiredStatus;
  17. try {
  18. stream = new MaryRandomAccessFile(codebookFile, "rw");
  19. currentFile = codebookFile;
  20. } catch (FileNotFoundException e) {
  21. // TODO Auto-generated catch block
  22. e.printStackTrace();
  23. }
  24. }
  25. }

代码示例来源:origin: marytts/marytts

  1. public SmoothingFile(String filename, int desiredStatus, int smoothingMethodIn) // smoothingMethod only effective when writing
  2. // to file
  3. {
  4. status = NOT_OPENED;
  5. stream = null;
  6. totalEntries = 0;
  7. smoothingMethod = smoothingMethodIn;
  8. if (desiredStatus == OPEN_FOR_READ) {
  9. status = desiredStatus;
  10. try {
  11. stream = new MaryRandomAccessFile(filename, "r");
  12. } catch (FileNotFoundException e) {
  13. // TODO Auto-generated catch block
  14. e.printStackTrace();
  15. }
  16. } else if (desiredStatus == OPEN_FOR_WRITE) {
  17. FileUtils.delete(filename);
  18. status = desiredStatus;
  19. try {
  20. stream = new MaryRandomAccessFile(filename, "rw");
  21. } catch (FileNotFoundException e) {
  22. // TODO Auto-generated catch block
  23. e.printStackTrace();
  24. }
  25. }
  26. }

代码示例来源:origin: marytts/marytts

  1. private void init(String pitchMappingFile, int desiredStatus) {
  2. status = NOT_OPENED;
  3. stream = null;
  4. currentFile = "";
  5. if (desiredStatus == OPEN_FOR_READ) {
  6. status = desiredStatus;
  7. try {
  8. stream = new MaryRandomAccessFile(pitchMappingFile, "r");
  9. currentFile = pitchMappingFile;
  10. } catch (FileNotFoundException e) {
  11. // TODO Auto-generated catch block
  12. e.printStackTrace();
  13. }
  14. } else if (desiredStatus == OPEN_FOR_WRITE) {
  15. FileUtils.delete(pitchMappingFile);
  16. status = desiredStatus;
  17. try {
  18. stream = new MaryRandomAccessFile(pitchMappingFile, "rw");
  19. currentFile = pitchMappingFile;
  20. } catch (FileNotFoundException e) {
  21. // TODO Auto-generated catch block
  22. e.printStackTrace();
  23. }
  24. }
  25. }

代码示例来源:origin: marytts/marytts

  1. private void init(String pitchMappingFile, int desiredStatus) {
  2. status = NOT_OPENED;
  3. stream = null;
  4. currentFile = "";
  5. if (desiredStatus == OPEN_FOR_READ) {
  6. status = desiredStatus;
  7. try {
  8. stream = new MaryRandomAccessFile(pitchMappingFile, "r");
  9. currentFile = pitchMappingFile;
  10. } catch (FileNotFoundException e) {
  11. // TODO Auto-generated catch block
  12. e.printStackTrace();
  13. }
  14. } else if (desiredStatus == OPEN_FOR_WRITE) {
  15. FileUtils.delete(pitchMappingFile);
  16. status = desiredStatus;
  17. try {
  18. stream = new MaryRandomAccessFile(pitchMappingFile, "rw");
  19. currentFile = pitchMappingFile;
  20. } catch (FileNotFoundException e) {
  21. // TODO Auto-generated catch block
  22. e.printStackTrace();
  23. }
  24. }
  25. }

代码示例来源:origin: marytts/marytts

  1. private void init(String codebookFile, int desiredStatus) {
  2. status = NOT_OPENED;
  3. stream = null;
  4. currentFile = "";
  5. if (desiredStatus == OPEN_FOR_READ) {
  6. status = desiredStatus;
  7. try {
  8. stream = new MaryRandomAccessFile(codebookFile, "r");
  9. currentFile = codebookFile;
  10. } catch (FileNotFoundException e) {
  11. // TODO Auto-generated catch block
  12. e.printStackTrace();
  13. }
  14. } else if (desiredStatus == OPEN_FOR_WRITE) {
  15. FileUtils.delete(codebookFile);
  16. status = desiredStatus;
  17. try {
  18. stream = new MaryRandomAccessFile(codebookFile, "rw");
  19. currentFile = codebookFile;
  20. } catch (FileNotFoundException e) {
  21. // TODO Auto-generated catch block
  22. e.printStackTrace();
  23. }
  24. }
  25. }

代码示例来源:origin: marytts/marytts

  1. public SmoothingFile(String filename, int desiredStatus, int smoothingMethodIn) // smoothingMethod only effective when writing
  2. // to file
  3. {
  4. status = NOT_OPENED;
  5. stream = null;
  6. totalEntries = 0;
  7. smoothingMethod = smoothingMethodIn;
  8. if (desiredStatus == OPEN_FOR_READ) {
  9. status = desiredStatus;
  10. try {
  11. stream = new MaryRandomAccessFile(filename, "r");
  12. } catch (FileNotFoundException e) {
  13. // TODO Auto-generated catch block
  14. e.printStackTrace();
  15. }
  16. } else if (desiredStatus == OPEN_FOR_WRITE) {
  17. FileUtils.delete(filename);
  18. status = desiredStatus;
  19. try {
  20. stream = new MaryRandomAccessFile(filename, "rw");
  21. } catch (FileNotFoundException e) {
  22. // TODO Auto-generated catch block
  23. e.printStackTrace();
  24. }
  25. }
  26. }

代码示例来源:origin: marytts/marytts

  1. public static void copyFolderRecursive(String sourceFolder, String targetFolder, boolean bForceDeleteTarget)
  2. throws IOException {
  3. String fileSeparator = System.getProperty("file.separator");
  4. if (exists(sourceFolder)) {
  5. if (exists(targetFolder) && bForceDeleteTarget)
  6. delete(targetFolder);
  7. createDirectory(targetFolder);
  8. if (exists(targetFolder)) {
  9. String[] fileList = new File(sourceFolder).list();
  10. if (fileList != null) {
  11. for (int i = 0; i < fileList.length; i++) {
  12. if (!fileList[i].startsWith(".")) {
  13. String source = StringUtils.checkLastSlash(sourceFolder) + fileList[i];
  14. if (new File(source).isDirectory()) {
  15. String newTargetFolder = StringUtils.checkLastSlash(targetFolder) + fileList[i];
  16. copyFolderRecursive(source, newTargetFolder, bForceDeleteTarget);
  17. } else {
  18. String targetFile = StringUtils.checkLastSlash(targetFolder) + fileList[i];
  19. copy(source, targetFile);
  20. }
  21. }
  22. }
  23. }
  24. } else
  25. System.out.println("Could not create target folder!");
  26. } else
  27. System.out.println("Source folder does not exist!");
  28. }

代码示例来源:origin: marytts/marytts

  1. public static void copyFolderRecursive(String sourceFolder, String targetFolder, boolean bForceDeleteTarget)
  2. throws IOException {
  3. String fileSeparator = System.getProperty("file.separator");
  4. if (exists(sourceFolder)) {
  5. if (exists(targetFolder) && bForceDeleteTarget)
  6. delete(targetFolder);
  7. createDirectory(targetFolder);
  8. if (exists(targetFolder)) {
  9. String[] fileList = new File(sourceFolder).list();
  10. if (fileList != null) {
  11. for (int i = 0; i < fileList.length; i++) {
  12. if (!fileList[i].startsWith(".")) {
  13. String source = StringUtils.checkLastSlash(sourceFolder) + fileList[i];
  14. if (new File(source).isDirectory()) {
  15. String newTargetFolder = StringUtils.checkLastSlash(targetFolder) + fileList[i];
  16. copyFolderRecursive(source, newTargetFolder, bForceDeleteTarget);
  17. } else {
  18. String targetFile = StringUtils.checkLastSlash(targetFolder) + fileList[i];
  19. copy(source, targetFile);
  20. }
  21. }
  22. }
  23. }
  24. } else
  25. System.out.println("Could not create target folder!");
  26. } else
  27. System.out.println("Source folder does not exist!");
  28. }

代码示例来源:origin: marytts/marytts

  1. public static void copyFolder(String sourceFolder, String targetFolder, boolean bForceDeleteTarget) throws IOException {
  2. if (exists(sourceFolder)) {
  3. if (exists(targetFolder) && bForceDeleteTarget)
  4. delete(targetFolder);
  5. createDirectory(targetFolder);
  6. if (exists(targetFolder)) {
  7. String[] fileList = FileUtils.getFileList(sourceFolder, "*.*");
  8. if (fileList != null) {
  9. for (int i = 0; i < fileList.length; i++) {
  10. String targetFile = StringUtils.checkLastSlash(targetFolder)
  11. + StringUtils.getFileName(fileList[i], false);
  12. copy(fileList[i], targetFile);
  13. }
  14. }
  15. } else
  16. System.out.println("Could not create target folder!");
  17. } else
  18. System.out.println("Source folder does not exist!");
  19. }

代码示例来源:origin: marytts/marytts

  1. public static void copyFolder(String sourceFolder, String targetFolder, boolean bForceDeleteTarget) throws IOException {
  2. if (exists(sourceFolder)) {
  3. if (exists(targetFolder) && bForceDeleteTarget)
  4. delete(targetFolder);
  5. createDirectory(targetFolder);
  6. if (exists(targetFolder)) {
  7. String[] fileList = FileUtils.getFileList(sourceFolder, "*.*");
  8. if (fileList != null) {
  9. for (int i = 0; i < fileList.length; i++) {
  10. String targetFile = StringUtils.checkLastSlash(targetFolder)
  11. + StringUtils.getFileName(fileList[i], false);
  12. copy(fileList[i], targetFile);
  13. }
  14. }
  15. } else
  16. System.out.println("Could not create target folder!");
  17. } else
  18. System.out.println("Source folder does not exist!");
  19. }

代码示例来源:origin: marytts/marytts

  1. public void convertToWav(AudioFormat audioformat) throws IOException {
  2. // Read the temp binary file into a wav file and delete the temp binary file
  3. if (tempOutBinaryFile != null) {
  4. double[] yOut = null;
  5. din = new LEDataInputStream(tempOutBinaryFile);
  6. yOut = din.readDouble(totalWrittenToFile);
  7. din.close();
  8. double tmpMax = MathUtils.getAbsMax(yOut);
  9. if (tmpMax > 1.0) {
  10. for (int n = 0; n < yOut.length; n++)
  11. yOut[n] /= tmpMax;
  12. }
  13. outputAudio = new DDSAudioInputStream(new BufferedDoubleDataSource(yOut), audioformat);
  14. AudioSystem.write(outputAudio, AudioFileFormat.Type.WAVE, new File(outputFile));
  15. FileUtils.delete(tempOutBinaryFile);
  16. //
  17. }
  18. }
  19. }

代码示例来源:origin: marytts/marytts

  1. public void convertToWav(AudioFormat audioformat) throws IOException {
  2. // Read the temp binary file into a wav file and delete the temp binary file
  3. if (tempOutBinaryFile != null) {
  4. double[] yOut = null;
  5. din = new LEDataInputStream(tempOutBinaryFile);
  6. yOut = din.readDouble(totalWrittenToFile);
  7. din.close();
  8. double tmpMax = MathUtils.getAbsMax(yOut);
  9. if (tmpMax > 1.0) {
  10. for (int n = 0; n < yOut.length; n++)
  11. yOut[n] /= tmpMax;
  12. }
  13. outputAudio = new DDSAudioInputStream(new BufferedDoubleDataSource(yOut), audioformat);
  14. AudioSystem.write(outputAudio, AudioFileFormat.Type.WAVE, new File(outputFile));
  15. FileUtils.delete(tempOutBinaryFile);
  16. //
  17. }
  18. }
  19. }

相关文章