org.apache.cxf.helpers.FileUtils.createTempFile()方法的使用及代码示例

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

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

FileUtils.createTempFile介绍

暂无

代码示例

代码示例来源:origin: apache/cxf

public static File createTempFile(String prefix, String suffix) throws IOException {
  return createTempFile(prefix, suffix, null, false);
}

代码示例来源:origin: org.apache.cxf/cxf-common-utilities

public static File createTempFile(String prefix, String suffix) throws IOException {
  return createTempFile(prefix, suffix, null, false);
}

代码示例来源:origin: org.apache.cxf/cxf-core

public static File createTempFile(String prefix, String suffix) throws IOException {
  return createTempFile(prefix, suffix, null, false);
}

代码示例来源:origin: org.apache.cxf/cxf-api

public static File createTempFile(String prefix, String suffix) throws IOException {
  return createTempFile(prefix, suffix, null, false);
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

public static File createTempFile(String prefix, String suffix) throws IOException {
  return createTempFile(prefix, suffix, null, false);
}

代码示例来源:origin: apache/cxf

private String[] createForkOnceArgs(List<List<String>> wargs) throws MojoExecutionException {
  try {
    File f = FileUtils.createTempFile("cxf-w2j", "args");
    PrintWriter fw = new PrintWriter(new FileWriter(f));
    for (List<String> args : wargs) {
      fw.println(Integer.toString(args.size()));
      for (String s : args) {
        fw.println(s);
      }
    }
    fw.println("-1");
    fw.close();
    return new String[] {f.getAbsolutePath()};
  } catch (IOException ex) {
    throw new MojoExecutionException("Could not create argument file", ex);
  }
}

代码示例来源:origin: apache/cxf

private InputSource convertToTmpInputSource(Element ele, String schemaLoc) throws Exception {
  InputSource result = null;
  ele.setAttributeNS(null, "schemaLocation", schemaLoc);
  File tmpFile = FileUtils.createTempFile("jaxbbinding", ".xml");
  StaxUtils.writeTo(ele, Files.newOutputStream(tmpFile.toPath()));
  result = new InputSource(URIParserUtil.getAbsoluteURI(tmpFile.getAbsolutePath()));
  tmpFile.deleteOnExit();
  return result;
}

代码示例来源:origin: apache/cxf

private InputSource convertToTmpInputSource(Element ele, String schemaLoc) throws Exception {
  InputSource result = null;
  ele.setAttribute("schemaLocation", schemaLoc);
  File tmpFile = FileUtils.createTempFile("jaxbbinding", ".xml");
  StaxUtils.writeTo(ele, Files.newOutputStream(tmpFile.toPath()));
  result = new InputSource(URIParserUtil.getAbsoluteURI(tmpFile.getAbsolutePath()));
  tmpFile.deleteOnExit();
  return result;
}

代码示例来源:origin: apache/cxf

private String[] createForkOnceArgs(List<List<String>> wargs) throws MojoExecutionException {
  try {
    File f = FileUtils.createTempFile("cxf-w2j", "args");
    PrintWriter fw = new PrintWriter(new FileWriter(f));
    for (List<String> args : wargs) {
      fw.println(Integer.toString(args.size()));
      for (String s : args) {
        fw.println(s);
      }
    }
    fw.println("-1");
    fw.close();
    return new String[] {
      f.getAbsolutePath()
    };
  } catch (IOException ex) {
    throw new MojoExecutionException("Could not create argument file", ex);
  }
}

代码示例来源:origin: org.apache.cxf/cxf-core

private void checkLongClasspath(String classpath, List<String> list, int classpathIdx) {
  if (isLongClasspath(classpath)) {
    PrintWriter out = null;
    try {
      classpathTmpFile = FileUtils.createTempFile("cxf-compiler-classpath", null);
      out = new PrintWriter(new FileWriter(classpathTmpFile));
      out.println(classpath);
      out.flush();
      out.close();
      list.set(classpathIdx + 1, "@" + classpathTmpFile);
    } catch (IOException e) {
      System.err.print("[ERROR] can't write long classpath to @argfile");
    }
  }
}

代码示例来源:origin: apache/cxf

private void checkLongClasspath(String classpath, List<String> list, int classpathIdx) {
  if (isLongClasspath(classpath)) {
    PrintWriter out = null;
    try {
      classpathTmpFile = FileUtils.createTempFile("cxf-compiler-classpath", null);
      out = new PrintWriter(new FileWriter(classpathTmpFile));
      out.println(classpath);
      out.flush();
      out.close();
      list.set(classpathIdx + 1, "@" + classpathTmpFile);
    } catch (IOException e) {
      System.err.print("[ERROR] can't write long classpath to @argfile");
    }
  }
}

代码示例来源:origin: apache/cxf

private InputSource convertToTmpInputSource(Element ele, String schemaLoc) throws Exception {
  InputSource result = null;
  ele.setAttributeNS(null, "schemaLocation", schemaLoc);
  File tmpFile = FileUtils.createTempFile("jaxbbinding", ".xml");
  StaxUtils.writeTo(ele, Files.newOutputStream(tmpFile.toPath()));
  result = new InputSource(URIParserUtil.getAbsoluteURI(tmpFile.getAbsolutePath()));
  tmpFile.deleteOnExit();
  return result;
}

代码示例来源:origin: org.apache.cxf/cxf-api

private void checkLongClasspath(String classpath, List<String> list, int classpathIdx) {
  if (isLongClasspath(classpath)) {
    PrintWriter out = null;
    try {
      classpathTmpFile = FileUtils.createTempFile("cxf-compiler-classpath", null);
      out = new PrintWriter(new FileWriter(classpathTmpFile));
      out.println(classpath);
      out.flush();
      out.close();
      list.set(classpathIdx + 1, "@" + classpathTmpFile);
    } catch (IOException e) {
      System.err.print("[ERROR] can't write long classpath to @argfile");
    }
  } 
}

代码示例来源:origin: org.apache.cxf/cxf-common-utilities

private void checkLongClasspath(String classpath, List<String> list, int classpathIdx) {
  if (isLongClasspath(classpath)) {
    PrintWriter out = null;
    try {
      classpathTmpFile = FileUtils.createTempFile("cxf-compiler-classpath", null);
      out = new PrintWriter(new FileWriter(classpathTmpFile));
      out.println(classpath);
      out.flush();
      out.close();
      list.set(classpathIdx + 1, "@" + classpathTmpFile);
    } catch (IOException e) {
      System.err.print("[ERROR] can't write long classpath to @argfile");
    }
  } 
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

private void checkLongClasspath(String classpath, List<String> list, int classpathIdx) {
  if (isLongClasspath(classpath)) {
    PrintWriter out = null;
    try {
      classpathTmpFile = FileUtils.createTempFile("cxf-compiler-classpath", null);
      out = new PrintWriter(new FileWriter(classpathTmpFile));
      out.println(classpath);
      out.flush();
      out.close();
      list.set(classpathIdx + 1, "@" + classpathTmpFile);
    } catch (IOException e) {
      System.err.print("[ERROR] can't write long classpath to @argfile");
    }
  } 
}

代码示例来源:origin: org.apache.cxf/cxf-tools-wsdlto-databinding-jaxb

private InputSource convertToTmpInputSource(Element ele, String schemaLoc) throws Exception {
  InputSource result = null;
  ele.setAttributeNS(null, "schemaLocation", schemaLoc);
  File tmpFile = FileUtils.createTempFile("jaxbbinding", ".xml");
  StaxUtils.writeTo(ele, Files.newOutputStream(tmpFile.toPath()));
  result = new InputSource(URIParserUtil.getAbsoluteURI(tmpFile.getAbsolutePath()));
  tmpFile.deleteOnExit();
  return result;
}

代码示例来源:origin: org.apache.cxf/cxf-codegen-plugin

private String[] createForkOnceArgs(List<List<String>> wargs) throws MojoExecutionException {
  try {
    File f = FileUtils.createTempFile("cxf-w2j", "args");
    PrintWriter fw = new PrintWriter(new FileWriter(f));
    for (List<String> args : wargs) {
      fw.println(Integer.toString(args.size()));
      for (String s : args) {
        fw.println(s);
      }
    }
    fw.println("-1");
    fw.close();
    return new String[] {
      f.getAbsolutePath()
    };
  } catch (IOException ex) {
    throw new MojoExecutionException("Could not create argument file", ex);
  }
}

代码示例来源:origin: apache/cxf

private void createFileOutputStream() throws IOException {
  if (tempFileFailed) {
    return;
  }
  ByteArrayOutputStream bout = (ByteArrayOutputStream)currentStream;
  try {
    if (outputDir == null) {
      tempFile = FileUtils.createTempFile("cos", "tmp");
    } else {
      tempFile = FileUtils.createTempFile("cos", "tmp", outputDir, false);
    }
    currentStream = createOutputStream(tempFile);
    bout.writeTo(currentStream);
    inmem = false;
    streamList.add(currentStream);
  } catch (Exception ex) {
    //Could be IOException or SecurityException or other issues.
    //Don't care what, just keep it in memory.
    tempFileFailed = true;
    if (currentStream != bout) {
      currentStream.close();
    }
    deleteTempFile();
    inmem = true;
    currentStream = bout;
  }
}

代码示例来源:origin: apache/cxf

private void createFileOutputStream() throws IOException {
  if (tempFileFailed) {
    return;
  }
  LoadingCharArrayWriter bout = (LoadingCharArrayWriter)currentStream;
  try {
    if (outputDir == null) {
      tempFile = FileUtils.createTempFile("cos", "tmp");
    } else {
      tempFile = FileUtils.createTempFile("cos", "tmp", outputDir, false);
    }
    currentStream = createOutputStreamWriter(tempFile);
    bout.writeTo(currentStream);
    inmem = false;
    streamList.add(currentStream);
  } catch (Exception ex) {
    //Could be IOException or SecurityException or other issues.
    //Don't care what, just keep it in memory.
    tempFileFailed = true;
    if (currentStream != bout) {
      currentStream.close();
    }
    deleteTempFile();
    inmem = true;
    currentStream = bout;
  }
}

代码示例来源:origin: apache/cxf

private File getSOAPBodyFile(Document doc) throws Exception {
  File file = FileUtils.createTempFile("cxf-systest", "xml");
  try (FileOutputStream out = new FileOutputStream(file)) {
    XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(out);
    StaxUtils.writeDocument(doc, writer, true);
    writer.close();
    return file;
  }
}

相关文章