jodd.io.FileUtil.createTempDirectory()方法的使用及代码示例

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

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

FileUtil.createTempDirectory介绍

暂无

代码示例

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

/**
 * Creates temporary directory.
 */
public static File createTempDirectory(String prefix, String suffix) throws IOException {
  return createTempDirectory(prefix, suffix, null);
}

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

public static File createTempDirectory() throws IOException {
  return createTempDirectory(JoddCore.tempFilePrefix, null, null);
}

代码示例来源:origin: oblac/jodd

/**
 * @see #createTempDirectory(String, String, File)
 */
public static File createTempDirectory(final String prefix, final String suffix) throws IOException {
  return createTempDirectory(prefix, suffix, null);
}

代码示例来源:origin: oblac/jodd

/**
 * @see #createTempDirectory(String, String)
 */
public static File createTempDirectory() throws IOException {
  return createTempDirectory(tempPrefix(), null);
}

代码示例来源:origin: oblac/jodd

@Test
void testZipEmptyFolder() throws IOException {
  byte[] bytes = ZipBuilder
    .createZipInMemory()
    .addFolder("myEmptyFolder")
    .toBytes();
  File tempDir = FileUtil.createTempDirectory();
  tempDir.deleteOnExit();
  File zipFile = new File(tempDir, "test.zip");
  FileUtil.writeBytes(zipFile, bytes);
  // read zip
  List<String> entries = ZipUtil.listZip(zipFile);
  assertEquals(1, entries.size());
  assertEquals("myEmptyFolder/", entries.get(0));
}

代码示例来源:origin: oblac/jodd

public void start() throws Exception {
  webRoot = FileUtil.createTempDirectory("jodd-http", "test");
  webRoot.deleteOnExit();

代码示例来源:origin: oblac/jodd

@Test
void testGetResource() throws IOException {
  File tempRoot = FileUtil.createTempDirectory("jodd", "tmp");
  File temp = new File(tempRoot, "pckg");
  FileUtil.mkdir(temp);

代码示例来源:origin: oblac/jodd

final File attFolder = FileUtil.createTempDirectory("jodd", "tt");

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

/**
 * @see #createTempDirectory(String, String, File)
 */
public static File createTempDirectory(final String prefix, final String suffix) throws IOException {
  return createTempDirectory(prefix, suffix, null);
}

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

/**
 * @see #createTempDirectory(String, String)
 */
public static File createTempDirectory() throws IOException {
  return createTempDirectory(tempPrefix(), null);
}

代码示例来源:origin: ru.yandex.qatools.embed/embedded-services

public AbstractEmbeddedService(String dataDirectory, boolean enabled, int initTimeout) throws IOException {
  this.enabled = enabled;
  this.initTimeout = initTimeout;
  if (isEmpty(dataDirectory) || dataDirectory.equals("TMP")) {
    this.removeDataDir = true;
    final String prefix = getClass().getName().substring(
        getClass().getName().lastIndexOf(".") + 1
    );
    this.dataDirectory = createTempDirectory(prefix, "data").getPath();
    this.newDirectory = true;
  } else {
    this.dataDirectory = dataDirectory;
    this.removeDataDir = false;
    this.newDirectory = !new File(dataDirectory).exists() || isDatadirEmpty();
  }
}

代码示例来源:origin: yandex-qatools/embedded-services

public AbstractEmbeddedService(String dataDirectory, boolean enabled, int initTimeout) throws IOException {
  this.enabled = enabled;
  this.initTimeout = initTimeout;
  if (isEmpty(dataDirectory) || dataDirectory.equals("TMP")) {
    this.removeDataDir = true;
    final String prefix = getClass().getName().substring(
        getClass().getName().lastIndexOf(".") + 1
    );
    this.dataDirectory = createTempDirectory(prefix, "data").getPath();
    this.newDirectory = true;
  } else {
    this.dataDirectory = dataDirectory;
    this.removeDataDir = false;
    this.newDirectory = !new File(dataDirectory).exists() || isDatadirEmpty();
  }
}

相关文章