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

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

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

FileUtils.delete介绍

暂无

代码示例

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

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

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

public void deleteTemporaryFiles(WeightedCodebookFeatureCollection fcol, BaselineAdaptationSet sourceTrainingSet,
      BaselineAdaptationSet targetTrainingSet) {
    FileUtils.delete(fcol.indexMapFiles, true);
    // FileUtils.delete(sourceTrainingSet.getLsfFiles(), true);
    // FileUtils.delete(targetTrainingSet.getLsfFiles(), true);
    // FileUtils.delete(sourceTrainingSet.getF0Files(), true);
    // FileUtils.delete(targetTrainingSet.getF0Files(), true);
    // FileUtils.delete(sourceTrainingSet.getEnergyFiles(), true);
    // FileUtils.delete(targetTrainingSet.getEnergyFiles(), true);

    FileUtils.delete(wcParams.temporaryCodebookFile);
  }
}

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

public void deleteTemporaryFiles(WeightedCodebookFeatureCollection fcol, BaselineAdaptationSet sourceTrainingSet,
      BaselineAdaptationSet targetTrainingSet) {
    FileUtils.delete(fcol.indexMapFiles, true);
    // FileUtils.delete(sourceTrainingSet.getLsfFiles(), true);
    // FileUtils.delete(targetTrainingSet.getLsfFiles(), true);
    // FileUtils.delete(sourceTrainingSet.getF0Files(), true);
    // FileUtils.delete(targetTrainingSet.getF0Files(), true);
    // FileUtils.delete(sourceTrainingSet.getEnergyFiles(), true);
    // FileUtils.delete(targetTrainingSet.getEnergyFiles(), true);

    FileUtils.delete(wcParams.temporaryCodebookFile);
  }
}

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

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

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

public static void delete(String[] files) {
  delete(files, false);
}

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

public static void delete(String[] files) {
  delete(files, false);
}

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

public static void delete(String file) {
  if (exists(file)) {
    delete(file, false);
  }
}

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

public static void delete(String file) {
  if (exists(file)) {
    delete(file, false);
  }
}

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

private void init(String codebookFile, int desiredStatus) {
  status = NOT_OPENED;
  stream = null;
  currentFile = "";
  if (desiredStatus == OPEN_FOR_READ) {
    status = desiredStatus;
    try {
      stream = new MaryRandomAccessFile(codebookFile, "r");
      currentFile = codebookFile;
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  } else if (desiredStatus == OPEN_FOR_WRITE) {
    FileUtils.delete(codebookFile);
    status = desiredStatus;
    try {
      stream = new MaryRandomAccessFile(codebookFile, "rw");
      currentFile = codebookFile;
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
}

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

public SmoothingFile(String filename, int desiredStatus, int smoothingMethodIn) // smoothingMethod only effective when writing
                                        // to file
{
  status = NOT_OPENED;
  stream = null;
  totalEntries = 0;
  smoothingMethod = smoothingMethodIn;
  if (desiredStatus == OPEN_FOR_READ) {
    status = desiredStatus;
    try {
      stream = new MaryRandomAccessFile(filename, "r");
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  } else if (desiredStatus == OPEN_FOR_WRITE) {
    FileUtils.delete(filename);
    status = desiredStatus;
    try {
      stream = new MaryRandomAccessFile(filename, "rw");
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
}

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

private void init(String pitchMappingFile, int desiredStatus) {
  status = NOT_OPENED;
  stream = null;
  currentFile = "";
  if (desiredStatus == OPEN_FOR_READ) {
    status = desiredStatus;
    try {
      stream = new MaryRandomAccessFile(pitchMappingFile, "r");
      currentFile = pitchMappingFile;
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  } else if (desiredStatus == OPEN_FOR_WRITE) {
    FileUtils.delete(pitchMappingFile);
    status = desiredStatus;
    try {
      stream = new MaryRandomAccessFile(pitchMappingFile, "rw");
      currentFile = pitchMappingFile;
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
}

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

private void init(String pitchMappingFile, int desiredStatus) {
  status = NOT_OPENED;
  stream = null;
  currentFile = "";
  if (desiredStatus == OPEN_FOR_READ) {
    status = desiredStatus;
    try {
      stream = new MaryRandomAccessFile(pitchMappingFile, "r");
      currentFile = pitchMappingFile;
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  } else if (desiredStatus == OPEN_FOR_WRITE) {
    FileUtils.delete(pitchMappingFile);
    status = desiredStatus;
    try {
      stream = new MaryRandomAccessFile(pitchMappingFile, "rw");
      currentFile = pitchMappingFile;
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
}

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

private void init(String codebookFile, int desiredStatus) {
  status = NOT_OPENED;
  stream = null;
  currentFile = "";
  if (desiredStatus == OPEN_FOR_READ) {
    status = desiredStatus;
    try {
      stream = new MaryRandomAccessFile(codebookFile, "r");
      currentFile = codebookFile;
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  } else if (desiredStatus == OPEN_FOR_WRITE) {
    FileUtils.delete(codebookFile);
    status = desiredStatus;
    try {
      stream = new MaryRandomAccessFile(codebookFile, "rw");
      currentFile = codebookFile;
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
}

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

public SmoothingFile(String filename, int desiredStatus, int smoothingMethodIn) // smoothingMethod only effective when writing
                                        // to file
{
  status = NOT_OPENED;
  stream = null;
  totalEntries = 0;
  smoothingMethod = smoothingMethodIn;
  if (desiredStatus == OPEN_FOR_READ) {
    status = desiredStatus;
    try {
      stream = new MaryRandomAccessFile(filename, "r");
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  } else if (desiredStatus == OPEN_FOR_WRITE) {
    FileUtils.delete(filename);
    status = desiredStatus;
    try {
      stream = new MaryRandomAccessFile(filename, "rw");
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
}

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

public static void copyFolderRecursive(String sourceFolder, String targetFolder, boolean bForceDeleteTarget)
    throws IOException {
  String fileSeparator = System.getProperty("file.separator");
  if (exists(sourceFolder)) {
    if (exists(targetFolder) && bForceDeleteTarget)
      delete(targetFolder);
    createDirectory(targetFolder);
    if (exists(targetFolder)) {
      String[] fileList = new File(sourceFolder).list();
      if (fileList != null) {
        for (int i = 0; i < fileList.length; i++) {
          if (!fileList[i].startsWith(".")) {
            String source = StringUtils.checkLastSlash(sourceFolder) + fileList[i];
            if (new File(source).isDirectory()) {
              String newTargetFolder = StringUtils.checkLastSlash(targetFolder) + fileList[i];
              copyFolderRecursive(source, newTargetFolder, bForceDeleteTarget);
            } else {
              String targetFile = StringUtils.checkLastSlash(targetFolder) + fileList[i];
              copy(source, targetFile);
            }
          }
        }
      }
    } else
      System.out.println("Could not create target folder!");
  } else
    System.out.println("Source folder does not exist!");
}

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

public static void copyFolderRecursive(String sourceFolder, String targetFolder, boolean bForceDeleteTarget)
    throws IOException {
  String fileSeparator = System.getProperty("file.separator");
  if (exists(sourceFolder)) {
    if (exists(targetFolder) && bForceDeleteTarget)
      delete(targetFolder);
    createDirectory(targetFolder);
    if (exists(targetFolder)) {
      String[] fileList = new File(sourceFolder).list();
      if (fileList != null) {
        for (int i = 0; i < fileList.length; i++) {
          if (!fileList[i].startsWith(".")) {
            String source = StringUtils.checkLastSlash(sourceFolder) + fileList[i];
            if (new File(source).isDirectory()) {
              String newTargetFolder = StringUtils.checkLastSlash(targetFolder) + fileList[i];
              copyFolderRecursive(source, newTargetFolder, bForceDeleteTarget);
            } else {
              String targetFile = StringUtils.checkLastSlash(targetFolder) + fileList[i];
              copy(source, targetFile);
            }
          }
        }
      }
    } else
      System.out.println("Could not create target folder!");
  } else
    System.out.println("Source folder does not exist!");
}

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

public static void copyFolder(String sourceFolder, String targetFolder, boolean bForceDeleteTarget) throws IOException {
  if (exists(sourceFolder)) {
    if (exists(targetFolder) && bForceDeleteTarget)
      delete(targetFolder);
    createDirectory(targetFolder);
    if (exists(targetFolder)) {
      String[] fileList = FileUtils.getFileList(sourceFolder, "*.*");
      if (fileList != null) {
        for (int i = 0; i < fileList.length; i++) {
          String targetFile = StringUtils.checkLastSlash(targetFolder)
              + StringUtils.getFileName(fileList[i], false);
          copy(fileList[i], targetFile);
        }
      }
    } else
      System.out.println("Could not create target folder!");
  } else
    System.out.println("Source folder does not exist!");
}

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

public static void copyFolder(String sourceFolder, String targetFolder, boolean bForceDeleteTarget) throws IOException {
  if (exists(sourceFolder)) {
    if (exists(targetFolder) && bForceDeleteTarget)
      delete(targetFolder);
    createDirectory(targetFolder);
    if (exists(targetFolder)) {
      String[] fileList = FileUtils.getFileList(sourceFolder, "*.*");
      if (fileList != null) {
        for (int i = 0; i < fileList.length; i++) {
          String targetFile = StringUtils.checkLastSlash(targetFolder)
              + StringUtils.getFileName(fileList[i], false);
          copy(fileList[i], targetFile);
        }
      }
    } else
      System.out.println("Could not create target folder!");
  } else
    System.out.println("Source folder does not exist!");
}

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

public void convertToWav(AudioFormat audioformat) throws IOException {
    // Read the temp binary file into a wav file and delete the temp binary file
    if (tempOutBinaryFile != null) {
      double[] yOut = null;

      din = new LEDataInputStream(tempOutBinaryFile);
      yOut = din.readDouble(totalWrittenToFile);
      din.close();

      double tmpMax = MathUtils.getAbsMax(yOut);
      if (tmpMax > 1.0) {
        for (int n = 0; n < yOut.length; n++)
          yOut[n] /= tmpMax;
      }

      outputAudio = new DDSAudioInputStream(new BufferedDoubleDataSource(yOut), audioformat);
      AudioSystem.write(outputAudio, AudioFileFormat.Type.WAVE, new File(outputFile));

      FileUtils.delete(tempOutBinaryFile);
      //
    }
  }
}

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

public void convertToWav(AudioFormat audioformat) throws IOException {
    // Read the temp binary file into a wav file and delete the temp binary file
    if (tempOutBinaryFile != null) {
      double[] yOut = null;

      din = new LEDataInputStream(tempOutBinaryFile);
      yOut = din.readDouble(totalWrittenToFile);
      din.close();

      double tmpMax = MathUtils.getAbsMax(yOut);
      if (tmpMax > 1.0) {
        for (int n = 0; n < yOut.length; n++)
          yOut[n] /= tmpMax;
      }

      outputAudio = new DDSAudioInputStream(new BufferedDoubleDataSource(yOut), audioformat);
      AudioSystem.write(outputAudio, AudioFileFormat.Type.WAVE, new File(outputFile));

      FileUtils.delete(tempOutBinaryFile);
      //
    }
  }
}

相关文章