gpt4 book ai didi

com.sun.tools.javac.file.ZipFileIndex.checkIndex()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 00:11:31 26 4
gpt4 key购买 nike

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

ZipFileIndex.checkIndex介绍

[英]Here we need to make sure that the ZipFileIndex is valid. Check the timestamp of the file and if its the same as the one at the time the index was build we don't need to reopen anything.
[中]这里我们需要确保ZipFileIndex是有效的。检查文件的时间戳,如果它与构建索引时的时间戳相同,我们不需要重新打开任何东西。

代码示例

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

/**
 * Returns the last modified timestamp of a zip file.
 * @return long
 */
public long getZipFileLastModified() throws IOException {
  synchronized (this) {
    checkIndex();
    return zipFileLastModified;
  }
}

代码示例来源:origin: konsoletyper/teavm-javac

/**
 * Returns the last modified timestamp of a zip file.
 * @return long
 */
public long getZipFileLastModified() throws IOException {
  synchronized (this) {
    checkIndex();
    return zipFileLastModified;
  }
}

代码示例来源:origin: konsoletyper/teavm-javac

public synchronized Set<RelativeDirectory> getAllDirectories() {
  try {
    checkIndex();
    if (allDirs == Collections.EMPTY_SET) {
      allDirs = new java.util.LinkedHashSet<RelativeDirectory>(directories.keySet());
    }
    return allDirs;
  }
  catch (IOException e) {
    return Collections.<RelativeDirectory>emptySet();
  }
}

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

public synchronized Set<RelativeDirectory> getAllDirectories() {
  try {
    checkIndex();
    if (allDirs == Collections.EMPTY_SET) {
      allDirs = new java.util.LinkedHashSet<RelativeDirectory>(directories.keySet());
    }
    return allDirs;
  }
  catch (IOException e) {
    return Collections.<RelativeDirectory>emptySet();
  }
}

代码示例来源:origin: sc.fiji/javac

/**
 * Returns the last modified timestamp of a zip file.
 * @return long
 */
public long getZipFileLastModified() throws IOException {
  lock.lock();
  try {
    checkIndex();
    return zipFileLastModified;
  }
  finally {
    lock.unlock();
  }
}

代码示例来源:origin: sc.fiji/javac

public Set<RelativeDirectory> getAllDirectories() {
  lock.lock();
  try {
    checkIndex();
    if (allDirs == Collections.EMPTY_SET) {
      allDirs = new HashSet<RelativeDirectory>(directories.keySet());
    }
    return allDirs;
  }
  catch (IOException e) {
    return Collections.<RelativeDirectory>emptySet();
  }
  finally {
    lock.unlock();
  }
}

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

public synchronized boolean isDirectory(RelativePath path) throws IOException {
  // The top level in a zip file is always a directory.
  if (path.getPath().length() == 0) {
    lastReferenceTimeStamp = System.currentTimeMillis();
    return true;
  }
  checkIndex();
  return directories.get(path) != null;
}

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

ZipFileIndex(File zipFile, RelativeDirectory symbolFilePrefix, boolean writeIndex,
    boolean useCache, String cacheLocation) throws IOException {
  this.zipFile = zipFile;
  this.symbolFilePrefix = symbolFilePrefix;
  this.symbolFilePrefixLength = (symbolFilePrefix == null ? 0 :
    symbolFilePrefix.getPath().getBytes("UTF-8").length);
  this.writeIndex = writeIndex;
  this.usePreindexedCache = useCache;
  this.preindexedCacheLocation = cacheLocation;
  if (zipFile != null) {
    this.zipFileLastModified = zipFile.lastModified();
  }
  // Validate integrity of the zip file
  checkIndex();
}

代码示例来源:origin: konsoletyper/teavm-javac

public synchronized boolean isDirectory(RelativePath path) throws IOException {
  // The top level in a zip file is always a directory.
  if (path.getPath().length() == 0) {
    lastReferenceTimeStamp = System.currentTimeMillis();
    return true;
  }
  checkIndex();
  return directories.get(path) != null;
}

代码示例来源:origin: konsoletyper/teavm-javac

/**
 * Tests if a specific path exists in the zip.  This method will return true
 * for file entries and directories.
 *
 * @param path A path within the zip.
 * @return True if the path is a file or dir, false otherwise.
 */
public synchronized boolean contains(RelativePath path) {
  try {
    checkIndex();
    return getZipIndexEntry(path) != null;
  }
  catch (IOException e) {
    return false;
  }
}

代码示例来源:origin: sc.fiji/javac

public boolean isDirectory(RelativePath path) throws IOException {
  lock.lock();
  try {
    // The top level in a zip file is always a directory.
    if (path.getPath().length() == 0) {
      lastReferenceTimeStamp = System.currentTimeMillis();
      return true;
    }
    checkIndex();
    return directories.get(path) != null;
  }
  finally {
    lock.unlock();
  }
}

代码示例来源:origin: sc.fiji/javac

private ZipFileIndex(File zipFile, RelativeDirectory symbolFilePrefix, boolean writeIndex,
    boolean useCache, String cacheLocation) throws IOException {
  this.zipFile = zipFile;
  this.symbolFilePrefix = symbolFilePrefix;
  this.symbolFilePrefixLength = (symbolFilePrefix == null ? 0 :
    symbolFilePrefix.getPath().getBytes("UTF-8").length);
  this.writeIndex = writeIndex;
  this.usePreindexedCache = useCache;
  this.preindexedCacheLocation = cacheLocation;
  if (zipFile != null) {
    this.zipFileLastModified = zipFile.lastModified();
  }
  // Validate integrity of the zip file
  checkIndex();
}

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

/**
 * Tests if a specific path exists in the zip.  This method will return true
 * for file entries and directories.
 *
 * @param path A path within the zip.
 * @return True if the path is a file or dir, false otherwise.
 */
public synchronized boolean contains(RelativePath path) {
  try {
    checkIndex();
    return getZipIndexEntry(path) != null;
  }
  catch (IOException e) {
    return false;
  }
}

代码示例来源:origin: konsoletyper/teavm-javac

ZipFileIndex(File zipFile, RelativeDirectory symbolFilePrefix, boolean writeIndex,
    boolean useCache, String cacheLocation) throws IOException {
  this.zipFile = zipFile;
  this.symbolFilePrefix = symbolFilePrefix;
  this.symbolFilePrefixLength = (symbolFilePrefix == null ? 0 :
    symbolFilePrefix.getPath().getBytes("UTF-8").length);
  this.writeIndex = writeIndex;
  this.usePreindexedCache = useCache;
  this.preindexedCacheLocation = cacheLocation;
  if (zipFile != null) {
    this.zipFileLastModified = zipFile.lastModified();
  }
  // Validate integrity of the zip file
  checkIndex();
}

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

/**
 * Returns the ZipFileIndexEntry for a path, if there is one.
 */
synchronized Entry getZipIndexEntry(RelativePath path) {
  try {
    checkIndex();
    DirectoryEntry de = directories.get(path.dirname());
    String lookFor = path.basename();
    return (de == null) ? null : de.getEntry(lookFor);
  }
  catch (IOException e) {
    return null;
  }
}

代码示例来源:origin: konsoletyper/teavm-javac

public synchronized List<String> getDirectories(RelativeDirectory path) {
  try {
    checkIndex();
    DirectoryEntry de = directories.get(path);
    com.sun.tools.javac.util.List<String> ret = de == null ? null : de.getDirectories();
    if (ret == null) {
      return com.sun.tools.javac.util.List.<String>nil();
    }
    return ret;
  }
  catch (IOException e) {
    return com.sun.tools.javac.util.List.<String>nil();
  }
}

代码示例来源:origin: sc.fiji/javac

public List<String> getDirectories(RelativeDirectory path) {
  lock.lock();
  try {
    checkIndex();
    DirectoryEntry de = directories.get(path);
    com.sun.tools.javac.util.List<String> ret = de == null ? null : de.getDirectories();
    if (ret == null) {
      return com.sun.tools.javac.util.List.<String>nil();
    }
    return ret;
  }
  catch (IOException e) {
    return com.sun.tools.javac.util.List.<String>nil();
  }
  finally {
    lock.unlock();
  }
}

代码示例来源:origin: konsoletyper/teavm-javac

/**
 * Returns the ZipFileIndexEntry for a path, if there is one.
 */
synchronized Entry getZipIndexEntry(RelativePath path) {
  try {
    checkIndex();
    DirectoryEntry de = directories.get(path.dirname());
    String lookFor = path.basename();
    return (de == null) ? null : de.getEntry(lookFor);
  }
  catch (IOException e) {
    return null;
  }
}

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

public synchronized List<String> getDirectories(RelativeDirectory path) {
  try {
    checkIndex();
    DirectoryEntry de = directories.get(path);
    com.sun.tools.javac.util.List<String> ret = de == null ? null : de.getDirectories();
    if (ret == null) {
      return com.sun.tools.javac.util.List.<String>nil();
    }
    return ret;
  }
  catch (IOException e) {
    return com.sun.tools.javac.util.List.<String>nil();
  }
}

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

/**
 * Returns a javac List of filenames within a directory in the ZipFileIndex.
 */
public synchronized com.sun.tools.javac.util.List<String> getFiles(RelativeDirectory path) {
  try {
    checkIndex();
    DirectoryEntry de = directories.get(path);
    com.sun.tools.javac.util.List<String> ret = de == null ? null : de.getFiles();
    if (ret == null) {
      return com.sun.tools.javac.util.List.<String>nil();
    }
    return ret;
  }
  catch (IOException e) {
    return com.sun.tools.javac.util.List.<String>nil();
  }
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com