com.twelvemonkeys.io.FileUtil.resolve()方法的使用及代码示例

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

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

FileUtil.resolve介绍

暂无

代码示例

代码示例来源:origin: haraldk/TwelveMonkeys

public LittleEndianRandomAccessFile(final String pName, final String pMode) throws FileNotFoundException {
  this(FileUtil.resolve(pName), pMode);
}

代码示例来源:origin: haraldk/TwelveMonkeys

return resolve(path);

代码示例来源:origin: haraldk/TwelveMonkeys

/**
 * Lists all files (and directories) in a specific folder which are
 * embraced by the wildcard filename mask provided.
 *
 * @param pFolder       The folder to list
 * @param pFilenameMask The wildcard filename mask
 * @return a list of {@code java.io.File} objects.
 * @see File#listFiles(FilenameFilter)
 * @throws FileNotFoundException if {@code pFolder} is not a readable file
 */
public static File[] list(final String pFolder, final String pFilenameMask) throws FileNotFoundException {
  if (StringUtil.isEmpty(pFolder)) {
    return null;
  }
  File folder = resolve(pFolder);
  if (!(/*folder.exists() &&*/folder.isDirectory() && folder.canRead())) {
    // NOTE: exists is implicitly called by isDirectory
    throw new FileNotFoundException("\"" + pFolder + "\" is not a directory or is not readable.");
  }
  if (StringUtil.isEmpty(pFilenameMask)) {
    return folder.listFiles();
  }
  // TODO: Rewrite to use regexp
  FilenameFilter filter = new FilenameMaskFilter(pFilenameMask);
  return folder.listFiles(filter);
}

代码示例来源:origin: haraldk/TwelveMonkeys

/**
 * Creates a (for now) read only {@code CompoundDocument}.
 * <p/>
 * <em>Warning! You must invoke {@link #close()} on the compound document
 * created from this constructor when done, to avoid leaking file
 * descriptors.</em>
 *
 * @param file the file to read from
 *
 * @throws IOException if an I/O exception occurs while reading the header
 */
public CompoundDocument(final File file) throws IOException {
  // TODO: We need to close this (or it's underlying RAF)! Otherwise we're leaking file descriptors!
  input = new LittleEndianRandomAccessFile(FileUtil.resolve(file), "r");
  // TODO: Might be better to read header on first read operation?!
  // OTOH: It's also good to be fail-fast, so at least we should make
  // sure we're reading a valid document
  readHeader();
}

代码示例来源:origin: com.github.lafa.twelvemonkeyspurejava.common/common-io

public LittleEndianRandomAccessFile(final String pName, final String pMode) throws FileNotFoundException {
  this(FileUtil.resolve(pName), pMode);
}

代码示例来源:origin: com.twelvemonkeys/twelvemonkeys-core

public LittleEndianRandomAccessFile(final String pName, final String pMode) throws FileNotFoundException {
  this(FileUtil.resolve(pName), pMode);
}

代码示例来源:origin: com.github.lafa.twelvemonkeyspurejava.common/common-io

/**
 * Creates a (for now) read only {@code CompoundDocument}.
 *
 * @param pFile the file to read from
 *
 * @throws IOException if an I/O exception occurs while reading the header
 */
public CompoundDocument(final File pFile) throws IOException {
  input = new LittleEndianRandomAccessFile(FileUtil.resolve(pFile), "r");
  // TODO: Might be better to read header on first read operation?!
  // OTOH: It's also good to be fail-fast, so at least we should make
  // sure we're reading a valid document
  readHeader();
}

代码示例来源:origin: com.twelvemonkeys/twelvemonkeys-core

/**
 * Creates a (for now) read only {@code CompoundDocument}.
 *
 * @param pFile the file to read from
 *
 * @throws IOException if an I/O exception occurs while reading the header
 */
public CompoundDocument(final File pFile) throws IOException {
  mInput = new LittleEndianRandomAccessFile(FileUtil.resolve(pFile), "r");
  // TODO: Might be better to read header on first read operation?!
  // OTOH: It's also good to be fail-fast, so at least we should make
  // sure we're reading a valid document
  readHeader();
}

代码示例来源:origin: com.github.lafa.twelvemonkeyspurejava.common/common-io

return resolve(path);

代码示例来源:origin: com.twelvemonkeys/twelvemonkeys-core

return resolve(path);

代码示例来源:origin: com.twelvemonkeys/twelvemonkeys-core

/**
 * Lists all files (and directories) in a specific folder which are
 * embraced by the wildcard filename mask provided.
 *
 * @param pFolder       The folder to list
 * @param pFilenameMask The wildcard filename mask
 * @return a list of {@code java.io.File} objects.
 * @see File#listFiles(FilenameFilter)
 * @throws FileNotFoundException if {@code pFolder} is not a readable file
 */
public static File[] list(final String pFolder, final String pFilenameMask) throws FileNotFoundException {
  if (StringUtil.isEmpty(pFolder)) {
    return null;
  }
  File folder = resolve(pFolder);
  if (!(/*folder.exists() &&*/folder.isDirectory() && folder.canRead())) {
    // NOTE: exists is implicitly called by isDirectory
    throw new FileNotFoundException("\"" + pFolder + "\" is not a directory or is not readable.");
  }
  if (StringUtil.isEmpty(pFilenameMask)) {
    return folder.listFiles();
  }
  FilenameFilter filter = new FilenameMaskFilter(pFilenameMask);
  return folder.listFiles(filter);
}

代码示例来源:origin: com.github.lafa.twelvemonkeyspurejava.common/common-io

/**
 * Lists all files (and directories) in a specific folder which are
 * embraced by the wildcard filename mask provided.
 *
 * @param pFolder       The folder to list
 * @param pFilenameMask The wildcard filename mask
 * @return a list of {@code java.io.File} objects.
 * @see File#listFiles(FilenameFilter)
 * @throws FileNotFoundException if {@code pFolder} is not a readable file
 */
public static File[] list(final String pFolder, final String pFilenameMask) throws FileNotFoundException {
  if (StringUtil.isEmpty(pFolder)) {
    return null;
  }
  File folder = resolve(pFolder);
  if (!(/*folder.exists() &&*/folder.isDirectory() && folder.canRead())) {
    // NOTE: exists is implicitly called by isDirectory
    throw new FileNotFoundException("\"" + pFolder + "\" is not a directory or is not readable.");
  }
  if (StringUtil.isEmpty(pFilenameMask)) {
    return folder.listFiles();
  }
  // TODO: Rewrite to use regexp
  FilenameFilter filter = new FilenameMaskFilter(pFilenameMask);
  return folder.listFiles(filter);
}

相关文章