com.sun.enterprise.util.io.FileUtils.openFileOutputStream()方法的使用及代码示例

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

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

FileUtils.openFileOutputStream介绍

[英]Opens a stream to the specified output file, retrying if necessary.
[中]打开指定输出文件的流,必要时重试。

代码示例

代码示例来源:origin: org.glassfish.common/common-util

/**
 * This method is used to copy a given file to another file
 * using the buffer sixe specified
 *
 * @param fin  the source file
 * @param fout the destination file
 */
public static void copyFile(File fin, File fout) throws IOException {
  InputStream inStream = new BufferedInputStream(new FileInputStream(fin));
  FileOutputStream fos = FileUtils.openFileOutputStream(fout);
  copy(inStream, fos, fin.length());
}

代码示例来源:origin: eclipse-ee4j/glassfish

/**
 * This method is used to copy a given file to another file
 * using the buffer sixe specified
 *
 * @param fin  the source file
 * @param fout the destination file
 */
public static void copyFile(File fin, File fout) throws IOException {
  InputStream inStream = new BufferedInputStream(new FileInputStream(fin));
  FileOutputStream fos = FileUtils.openFileOutputStream(fout);
  copy(inStream, fos, fin.length());
}

代码示例来源:origin: org.glassfish.main.common/common-util

/**
 * This method is used to copy a given file to another file
 * using the buffer sixe specified
 *
 * @param fin  the source file
 * @param fout the destination file
 */
public static void copyFile(File fin, File fout) throws IOException {
  InputStream inStream = new BufferedInputStream(new FileInputStream(fin));
  FileOutputStream fos = FileUtils.openFileOutputStream(fout);
  copy(inStream, fos, fin.length());
}

代码示例来源:origin: org.glassfish.common/common-util

/**
 * If the path dir/file does not exist, look for it in the classpath. If found
 * in classpath, create dir/file.
 *
 * @param file - path to look for
 * @param dir - directory where the path file should exist
 * @return the File representing dir/file. If that does not exist, return null.
 * @throws IOException
 */
public static File getManagedFile(String file, File dir) throws IOException {
  File f = new File(dir, file);
  if (f.exists())
    return f;
  InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(file);
  if (is == null)
    return null;
  InputStream bis = new BufferedInputStream(is);
  f.getParentFile().mkdirs();
  OutputStream os = new BufferedOutputStream(FileUtils.openFileOutputStream(f));
  byte buf[] = new byte[10240];
  int len = 0;
  while ((len =bis.read(buf)) > 0) {
    os.write(buf, 0, len);
  }
  os.close();
  is.close();
  return f;
}

代码示例来源:origin: eclipse-ee4j/glassfish

throw new RuntimeException("Can't create parent dir of output file: " + f);
os = new BufferedOutputStream(FileUtils.openFileOutputStream(f));
byte buf[] = new byte[10240];
int len = 0;

代码示例来源:origin: org.glassfish.main.common/common-util

throw new RuntimeException("Can't create parent dir of output file: " + f);
os = new BufferedOutputStream(FileUtils.openFileOutputStream(f));
byte buf[] = new byte[10240];
int len = 0;

代码示例来源:origin: org.glassfish.deployment/deployment-common

FileOutputStream fos = FileUtils.openFileOutputStream(out);
FileUtils.copy(is, fos, entry.getSize());

相关文章