org.apache.wicket.util.file.File类的使用及代码示例

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

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

File介绍

[英]Simple extension of File that adds an implementation of IModifiable for files. This allows the ModificationWatcher class to watch files for modification. The IModifiable.lastModifiedTime() method also returns a Time object with a more convenient API than either Date or a value in milliseconds.
[中]文件的简单扩展名,它添加了IModifiable for files的实现。这允许ModificationWatcher类监视要修改的文件。不可修改的。方法还返回一个时间对象,该对象的API比日期或毫秒值更方便。

代码示例

代码示例来源:origin: org.apache.wicket/wicket-util

/**
 * @param name
 *            Name of child file
 * @return Child file object
 */
public File file(final String name)
{
  return new File(this, name);
}

代码示例来源:origin: org.apache.wicket/wicket-util

/**
 * Looks for {@code pathname} in the provided {@code folder}.
 *
 * @param clazz
 *      The class requesting the resource stream
 * @param pathname
 *      the path to the needed resource. Must be relative to {@code folder}
 * @see org.apache.wicket.util.file.IResourceFinder#find(Class, String)
 */
@Override
public IResourceStream find(final Class<?> clazz, final String pathname)
{
  final File file = new File(folder, pathname);
  if (file.exists())
  {
    return new FileResourceStream(file);
  }
  else
  {
    return null;
  }
}

代码示例来源:origin: org.wicketstuff/maven-support

private static IResourceStream getFileSysResourceStream(String prefix, String path)
  {
    File f=new File(prefix+path);
    if ((f.exists()) && (f.isFile()))
    {
      return new FileResourceStream(f);
    }
    else
    {
      _logger.debug("Could not get File: {}",f.getAbsolutePath());
    }
    return null;
  }
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

/**
   * Add the license header to the start of the file without caring about existing license
   * headers.
   * 
   * @param file
   *            The file to add the license header to.
   */
  protected void prependLicenseHeader(File file)
  {
    try
    {
      String content = new org.apache.wicket.util.file.File(file).readString();
      content = getLicenseHeader() + LINE_ENDING + content;
      new org.apache.wicket.util.file.File(file).write(content);
    }
    catch (Exception e)
    {
      Assert.fail(e.getMessage());
    }
  }
}

代码示例来源:origin: org.geoserver.community/gs-geogig

private Component repositoryLink(String id, LogEvent item) {
  String repositoryURL = item.getRepositoryURL();
  String name = new File(repositoryURL).getName();
  Label label = new Label(id, name);
  label.add(AttributeModifier.replace("title", repositoryURL));
  return label;
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

final boolean recursive) throws IOException
if (!dir.isDirectory())
String[] files = dir.list();
  File f = new File(dir, files[i]);
  if (f.isDirectory())
      zipDir(f, out, path + f.getName() + "/", recursive);
    out.putNextEntry(new ZipEntry(path.toString() + f.getName()));

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

public int countSpillFiles() throws IOException {
  File cwd = new File("./");
  return cwd.list(SPILL_FILE_FILTER).length;
}

代码示例来源:origin: brix-cms/brix-cms

try {
  final File home = new File(url.substring(6));
  mkdirs(home);
  File cfg = new File(home, "repository.xml");
  if (!cfg.exists()) {
    copyClassResourceToFile("/org/brixcms/demo/repository.xml", cfg);
  RepositoryConfig config = RepositoryConfig.create(configStream, home.getAbsolutePath());
  return RepositoryImpl.create(config);

代码示例来源:origin: org.jabylon/log.viewer

@Override
public List<LogFile> getLogFiles() {
  File logFile = new File(System.getProperty("karaf.data"),"log/karaf.log");
  LogFile logFileInfo = new LogFile();
  logFileInfo.setLocation(logFile.getAbsolutePath());
  return Collections.singletonList(logFileInfo);
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

if (file.exists() == false)
      file.getAbsolutePath());
if (file.isFile() == false)

代码示例来源:origin: org.apache.wicket/wicket-util

/**
 * @return File extension (whatever is after the last '.' in the file name)
 */
public String getExtension()
{
  final int lastDot = getName().lastIndexOf('.');
  if (lastDot >= 0)
  {
    return getName().substring(lastDot + 1);
  }
  return null;
}

代码示例来源:origin: org.apache.wicket/wicket-util

@Override
  public String locationAsString()
  {
    if (file != null)
    {
      return file.getAbsolutePath();
    }
    return null;
  }
}

代码示例来源:origin: org.geoserver.community/gs-nsg-wfs-profile

@Override
  public void run() {
    while (true) {
      Map<String, Object> params = ic.getCurrentDataStoreParams();
      boolean condition =
          (dd.root().getPath() + "/nsg-profile/db/resultSets2")
                  .equals(
                      params.get(
                          JDBCDataStoreFactory
                              .DATABASE
                              .key))
              && dbDataFile.exists();
      if (condition) {
        done.countDown();
        break;
      }
      try {
        Thread.sleep(100);
      } catch (Exception e) {
      }
    }
  }
})

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

/**
   * Add the license header to the start of the file without caring about existing license
   * headers.
   * 
   * @param file
   *            The file to add the license header to.
   */
  protected void prependLicenseHeader(File file)
  {
    try
    {
      String content = new org.apache.wicket.util.file.File(file).readString();
      content = getLicenseHeader() + LINE_ENDING + content;
      new org.apache.wicket.util.file.File(file).write(content);
    }
    catch (Exception e)
    {
      Assert.fail(e.getMessage());
    }
  }
}

代码示例来源:origin: org.apache.oodt/oodt-webapp-components

public static Set<String> getImageFiles(String packageName) {
 Pattern pattern = Pattern.compile(".*\\.(png|gif|jpg|jpeg|jp2)");
 Set<String> resources = new Reflections(packageName, new ResourcesScanner())
   .getResources(pattern);
 Set<String> filteredResources = new HashSet<String>();
 Map<String, Boolean> resMap = new ConcurrentHashMap<String, Boolean>();
 for (String res : resources) {
  String resName = new File(res).getName();
  if (!resMap.containsKey(resName)) {
   resMap.put(resName, true);
   filteredResources.add(resName);
  }
 }
 return filteredResources;
}

代码示例来源:origin: org.apache.wicket/wicket-util

Args.isTrue(dir.isDirectory(), "Not a directory: '{}'", dir);
String[] files = dir.list();
    File f = new File(dir, file);
    if (f.isDirectory())
        zipDir(f, out, path + f.getName() + "/", recursive);
      out.putNextEntry(new ZipEntry(path + f.getName()));

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

public void removeSpillFiles() throws IOException {
  File cwd = new File("./");
  String[] spills = cwd.list(SPILL_FILE_FILTER);
  for (String fileName : spills) {
    Files.delete(Paths.get(fileName));
  }
}

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

if (file.exists() == false)
      file.getAbsolutePath());
if (file.isFile() == false)

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

/**
 * @return File extension (whatever is after the last '.' in the file name)
 */
public String getExtension()
{
  final int lastDot = getName().lastIndexOf('.');
  if (lastDot >= 0)
  {
    return getName().substring(lastDot + 1);
  }
  return null;
}

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

/**
   * @see org.apache.wicket.util.resource.IFixedLocationResourceStream#locationAsString()
   */
  public String locationAsString()
  {
    if (file != null)
    {
      return file.getAbsolutePath();
    }
    return null;
  }
}

相关文章