org.eclipse.jdt.internal.compiler.util.Util.buildAllDirectoriesInto()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(13.4k)|赞(0)|评价(0)|浏览(99)

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

Util.buildAllDirectoriesInto介绍

[英]Build all the directories and subdirectories corresponding to the packages names into the directory specified in parameters. outputPath is formed like: c:\temp\ the last character is a file separator relativeFileName is formed like: java\lang\String.class
[中]将与包名称对应的所有目录和子目录构建到参数中指定的目录中。outputPath的格式为:c:\temp\最后一个字符是文件分隔符relativeFileName的格式为:java\lang\String。班

代码示例

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

private static FileOutputStream getFileOutputStream(boolean generatePackagesStructure, String outputPath, String relativeFileName) throws IOException {
  if (generatePackagesStructure) {
    return new FileOutputStream(new File(buildAllDirectoriesInto(outputPath, relativeFileName)));
  } else {
    String fileName = null;
    char fileSeparatorChar = File.separatorChar;
    String fileSeparator = File.separator;
    // First we ensure that the outputPath exists
    outputPath = outputPath.replace('/', fileSeparatorChar);
    // To be able to pass the mkdirs() method we need to remove the extra file separator at the end of the outDir name
    int indexOfPackageSeparator = relativeFileName.lastIndexOf(fileSeparatorChar);
    if (indexOfPackageSeparator == -1) {
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName;
      } else {
        fileName = outputPath + fileSeparator + relativeFileName;
      }
    } else {
      int length = relativeFileName.length();
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      } else {
        fileName = outputPath + fileSeparator + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      }
    }
    return new FileOutputStream(new File(fileName));
  }
}

代码示例来源:origin: org.eclipse.jdt.core.compiler/ecj

private static FileOutputStream getFileOutputStream(boolean generatePackagesStructure, String outputPath, String relativeFileName) throws IOException {
  if (generatePackagesStructure) {
    return new FileOutputStream(new File(buildAllDirectoriesInto(outputPath, relativeFileName)));
  } else {
    String fileName = null;
    char fileSeparatorChar = File.separatorChar;
    String fileSeparator = File.separator;
    // First we ensure that the outputPath exists
    outputPath = outputPath.replace('/', fileSeparatorChar);
    // To be able to pass the mkdirs() method we need to remove the extra file separator at the end of the outDir name
    int indexOfPackageSeparator = relativeFileName.lastIndexOf(fileSeparatorChar);
    if (indexOfPackageSeparator == -1) {
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName;
      } else {
        fileName = outputPath + fileSeparator + relativeFileName;
      }
    } else {
      int length = relativeFileName.length();
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      } else {
        fileName = outputPath + fileSeparator + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      }
    }
    return new FileOutputStream(new File(fileName));
  }
}

代码示例来源:origin: com.vaadin/vaadin-client-compiler-deps

private static FileOutputStream getFileOutputStream(boolean generatePackagesStructure, String outputPath, String relativeFileName) throws IOException {
  if (generatePackagesStructure) {
    return new FileOutputStream(new File(buildAllDirectoriesInto(outputPath, relativeFileName)));
  } else {
    String fileName = null;
    char fileSeparatorChar = File.separatorChar;
    String fileSeparator = File.separator;
    // First we ensure that the outputPath exists
    outputPath = outputPath.replace('/', fileSeparatorChar);
    // To be able to pass the mkdirs() method we need to remove the extra file separator at the end of the outDir name
    int indexOfPackageSeparator = relativeFileName.lastIndexOf(fileSeparatorChar);
    if (indexOfPackageSeparator == -1) {
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName;
      } else {
        fileName = outputPath + fileSeparator + relativeFileName;
      }
    } else {
      int length = relativeFileName.length();
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      } else {
        fileName = outputPath + fileSeparator + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      }
    }
    return new FileOutputStream(new File(fileName));
  }
}

代码示例来源:origin: org.eclipse.jetty.orbit/org.eclipse.jdt.core

private static FileOutputStream getFileOutputStream(boolean generatePackagesStructure, String outputPath, String relativeFileName) throws IOException {
  if (generatePackagesStructure) {
    return new FileOutputStream(new File(buildAllDirectoriesInto(outputPath, relativeFileName)));
  } else {
    String fileName = null;
    char fileSeparatorChar = File.separatorChar;
    String fileSeparator = File.separator;
    // First we ensure that the outputPath exists
    outputPath = outputPath.replace('/', fileSeparatorChar);
    // To be able to pass the mkdirs() method we need to remove the extra file separator at the end of the outDir name
    int indexOfPackageSeparator = relativeFileName.lastIndexOf(fileSeparatorChar);
    if (indexOfPackageSeparator == -1) {
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName;
      } else {
        fileName = outputPath + fileSeparator + relativeFileName;
      }
    } else {
      int length = relativeFileName.length();
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      } else {
        fileName = outputPath + fileSeparator + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      }
    }
    return new FileOutputStream(new File(fileName));
  }
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

private static FileOutputStream getFileOutputStream(boolean generatePackagesStructure, String outputPath, String relativeFileName) throws IOException {
  if (generatePackagesStructure) {
    return new FileOutputStream(new File(buildAllDirectoriesInto(outputPath, relativeFileName)));
  } else {
    String fileName = null;
    char fileSeparatorChar = File.separatorChar;
    String fileSeparator = File.separator;
    // First we ensure that the outputPath exists
    outputPath = outputPath.replace('/', fileSeparatorChar);
    // To be able to pass the mkdirs() method we need to remove the extra file separator at the end of the outDir name
    int indexOfPackageSeparator = relativeFileName.lastIndexOf(fileSeparatorChar);
    if (indexOfPackageSeparator == -1) {
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName;
      } else {
        fileName = outputPath + fileSeparator + relativeFileName;
      }
    } else {
      int length = relativeFileName.length();
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      } else {
        fileName = outputPath + fileSeparator + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      }
    }
    return new FileOutputStream(new File(fileName));
  }
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

private static FileOutputStream getFileOutputStream(boolean generatePackagesStructure, String outputPath, String relativeFileName) throws IOException {
  if (generatePackagesStructure) {
    return new FileOutputStream(new File(buildAllDirectoriesInto(outputPath, relativeFileName)));
  } else {
    String fileName = null;
    char fileSeparatorChar = File.separatorChar;
    String fileSeparator = File.separator;
    // First we ensure that the outputPath exists
    outputPath = outputPath.replace('/', fileSeparatorChar);
    // To be able to pass the mkdirs() method we need to remove the extra file separator at the end of the outDir name
    int indexOfPackageSeparator = relativeFileName.lastIndexOf(fileSeparatorChar);
    if (indexOfPackageSeparator == -1) {
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName;
      } else {
        fileName = outputPath + fileSeparator + relativeFileName;
      }
    } else {
      int length = relativeFileName.length();
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      } else {
        fileName = outputPath + fileSeparator + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      }
    }
    return new FileOutputStream(new File(fileName));
  }
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

private static FileOutputStream getFileOutputStream(boolean generatePackagesStructure, String outputPath, String relativeFileName) throws IOException {
  if (generatePackagesStructure) {
    return new FileOutputStream(new File(buildAllDirectoriesInto(outputPath, relativeFileName)));
  } else {
    String fileName = null;
    char fileSeparatorChar = File.separatorChar;
    String fileSeparator = File.separator;
    // First we ensure that the outputPath exists
    outputPath = outputPath.replace('/', fileSeparatorChar);
    // To be able to pass the mkdirs() method we need to remove the extra file separator at the end of the outDir name
    int indexOfPackageSeparator = relativeFileName.lastIndexOf(fileSeparatorChar);
    if (indexOfPackageSeparator == -1) {
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName;
      } else {
        fileName = outputPath + fileSeparator + relativeFileName;
      }
    } else {
      int length = relativeFileName.length();
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      } else {
        fileName = outputPath + fileSeparator + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      }
    }
    return new FileOutputStream(new File(fileName));
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/ecj

private static FileOutputStream getFileOutputStream(boolean generatePackagesStructure, String outputPath, String relativeFileName) throws IOException {
  if (generatePackagesStructure) {
    return new FileOutputStream(new File(buildAllDirectoriesInto(outputPath, relativeFileName)));
  } else {
    String fileName = null;
    char fileSeparatorChar = File.separatorChar;
    String fileSeparator = File.separator;
    // First we ensure that the outputPath exists
    outputPath = outputPath.replace('/', fileSeparatorChar);
    // To be able to pass the mkdirs() method we need to remove the extra file separator at the end of the outDir name
    int indexOfPackageSeparator = relativeFileName.lastIndexOf(fileSeparatorChar);
    if (indexOfPackageSeparator == -1) {
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName;
      } else {
        fileName = outputPath + fileSeparator + relativeFileName;
      }
    } else {
      int length = relativeFileName.length();
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      } else {
        fileName = outputPath + fileSeparator + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      }
    }
    return new FileOutputStream(new File(fileName));
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

private static FileOutputStream getFileOutputStream(boolean generatePackagesStructure, String outputPath, String relativeFileName) throws IOException {
  if (generatePackagesStructure) {
    return new FileOutputStream(new File(buildAllDirectoriesInto(outputPath, relativeFileName)));
  } else {
    String fileName = null;
    char fileSeparatorChar = File.separatorChar;
    String fileSeparator = File.separator;
    // First we ensure that the outputPath exists
    outputPath = outputPath.replace('/', fileSeparatorChar);
    // To be able to pass the mkdirs() method we need to remove the extra file separator at the end of the outDir name
    int indexOfPackageSeparator = relativeFileName.lastIndexOf(fileSeparatorChar);
    if (indexOfPackageSeparator == -1) {
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName;
      } else {
        fileName = outputPath + fileSeparator + relativeFileName;
      }
    } else {
      int length = relativeFileName.length();
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      } else {
        fileName = outputPath + fileSeparator + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      }
    }
    return new FileOutputStream(new File(fileName));
  }
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

private static FileOutputStream getFileOutputStream(boolean generatePackagesStructure, String outputPath, String relativeFileName) throws IOException {
  if (generatePackagesStructure) {
    return new FileOutputStream(new File(buildAllDirectoriesInto(outputPath, relativeFileName)));
  } else {
    String fileName = null;
    char fileSeparatorChar = File.separatorChar;
    String fileSeparator = File.separator;
    // First we ensure that the outputPath exists
    outputPath = outputPath.replace('/', fileSeparatorChar);
    // To be able to pass the mkdirs() method we need to remove the extra file separator at the end of the outDir name
    int indexOfPackageSeparator = relativeFileName.lastIndexOf(fileSeparatorChar);
    if (indexOfPackageSeparator == -1) {
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName;
      } else {
        fileName = outputPath + fileSeparator + relativeFileName;
      }
    } else {
      int length = relativeFileName.length();
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      } else {
        fileName = outputPath + fileSeparator + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      }
    }
    return new FileOutputStream(new File(fileName));
  }
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

private static FileOutputStream getFileOutputStream(boolean generatePackagesStructure, String outputPath, String relativeFileName) throws IOException {
  if (generatePackagesStructure) {
    return new FileOutputStream(new File(buildAllDirectoriesInto(outputPath, relativeFileName)));
  } else {
    String fileName = null;
    char fileSeparatorChar = File.separatorChar;
    String fileSeparator = File.separator;
    // First we ensure that the outputPath exists
    outputPath = outputPath.replace('/', fileSeparatorChar);
    // To be able to pass the mkdirs() method we need to remove the extra file separator at the end of the outDir name
    int indexOfPackageSeparator = relativeFileName.lastIndexOf(fileSeparatorChar);
    if (indexOfPackageSeparator == -1) {
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName;
      } else {
        fileName = outputPath + fileSeparator + relativeFileName;
      }
    } else {
      int length = relativeFileName.length();
      if (outputPath.endsWith(fileSeparator)) {
        fileName = outputPath + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      } else {
        fileName = outputPath + fileSeparator + relativeFileName.substring(indexOfPackageSeparator + 1, length);
      }
    }
    return new FileOutputStream(new File(fileName));
  }
}

相关文章