aQute.bnd.osgi.Jar.check()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(77)

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

Jar.check介绍

暂无

代码示例

代码示例来源:origin: biz.aQute/bndlib

public void setManifest(Manifest manifest) {
  check();
  manifestFirst = true;
  this.manifest = manifest;
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

public void setManifest(Manifest manifest) {
  check();
  manifestFirst = true;
  this.manifest = manifest;
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

private String getDirectory(String path) {
  check();
  int n = path.lastIndexOf('/');
  if (n < 0)
    return "";
  return path.substring(0, n);
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

public void setManifestName(String manifestName) {
  check();
  if (manifestName == null || manifestName.length() == 0)
    throw new IllegalArgumentException("Manifest name cannot be null or empty!");
  this.manifestName = manifestName;
}

代码示例来源:origin: biz.aQute/bndlib

private String getDirectory(String path) {
  check();
  int n = path.lastIndexOf('/');
  if (n < 0)
    return "";
  return path.substring(0, n);
}

代码示例来源:origin: biz.aQute/bndlib

public List<String> getPackages() {
  check();
  List<String> list = new ArrayList<String>(directories.size());
  for (Map.Entry<String,Map<String,Resource>> i : directories.entrySet()) {
    if (i.getValue() != null) {
      String path = i.getKey();
      String pack = path.replace('/', '.');
      list.add(pack);
    }
  }
  return list;
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

public List<String> getPackages() {
  check();
  return directories.entrySet()
    .stream()
    .filter(e -> e.getValue() != null)
    .map(e -> e.getKey()
      .replace('/', '.'))
    .collect(Collectors.toList());
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

public Resource remove(String path) {
  check();
  Resource resource = resources.remove(path);
  if (resource != null) {
    String dir = getDirectory(path);
    Map<String, Resource> mdir = directories.get(dir);
    // must be != null
    mdir.remove(path);
  }
  return resource;
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

public boolean addDirectory(Map<String, Resource> directory, boolean overwrite) {
  check();
  boolean duplicates = false;
  if (directory == null)
    return false;
  for (Map.Entry<String, Resource> entry : directory.entrySet()) {
    duplicates |= putResource(entry.getKey(), entry.getValue(), overwrite);
  }
  return duplicates;
}

代码示例来源:origin: biz.aQute/bndlib

private void doManifest(Set<String> done, ZipOutputStream jout) throws Exception {
  check();
  if (nomanifest)
    return;
  JarEntry ze = new JarEntry("META-INF/MANIFEST.MF");
  jout.putNextEntry(ze);
  writeManifest(jout);
  jout.closeEntry();
  done.add(ze.getName());
}

代码示例来源:origin: biz.aQute/bndlib

public String getVersion() throws Exception {
  check();
  Manifest m = getManifest();
  if (m == null)
    return null;
  String s = m.getMainAttributes().getValue(Constants.BUNDLE_VERSION);
  if (s == null)
    return null;
  return s.trim();
}

代码示例来源:origin: biz.aQute/bndlib

public void setManifest(File file) throws IOException {
  check();
  FileInputStream fin = new FileInputStream(file);
  try {
    Manifest m = new Manifest(fin);
    setManifest(m);
  }
  finally {
    fin.close();
  }
}

代码示例来源:origin: biz.aQute/bndlib

public Resource remove(String path) {
  check();
  Resource resource = resources.remove(path);
  String dir = getDirectory(path);
  Map<String,Resource> mdir = directories.get(dir);
  // must be != null
  mdir.remove(path);
  return resource;
}

代码示例来源:origin: biz.aQute/bndlib

public Manifest getManifest() throws Exception {
  check();
  if (manifest == null) {
    Resource manifestResource = getResource("META-INF/MANIFEST.MF");
    if (manifestResource != null) {
      InputStream in = manifestResource.openInputStream();
      manifest = new Manifest(in);
      in.close();
    }
  }
  return manifest;
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

public void setManifest(File file) throws IOException {
  check();
  try (InputStream fin = IO.stream(file)) {
    Manifest m = new Manifest(fin);
    setManifest(m);
  }
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

public Manifest getManifest() throws Exception {
  check();
  if (manifest == null) {
    Resource manifestResource = getResource(manifestName);
    if (manifestResource != null) {
      try (InputStream in = manifestResource.openInputStream()) {
        manifest = new Manifest(in);
      }
    }
  }
  return manifest;
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

public void copy(Jar srce, String path, boolean overwrite) {
  check();
  addDirectory(srce.getDirectories()
    .get(path), overwrite);
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

public boolean rename(String oldPath, String newPath) {
  check();
  Resource resource = remove(oldPath);
  if (resource == null)
    return false;
  return putResource(newPath, resource);
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

public void write(File file) throws Exception {
  check();
  try (OutputStream out = IO.outputStream(file)) {
    write(out);
  } catch (Exception t) {
    IO.delete(file);
    throw t;
  }
  file.setLastModified(lastModified);
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

/**
 * Cleanup the manifest for writing. Cleaning up consists of adding a space
 * after any \n to prevent the manifest to see this newline as a delimiter.
 * 
 * @param out Output
 * @throws IOException
 */
public void writeManifest(OutputStream out) throws Exception {
  check();
  stripSignatures();
  writeManifest(getManifest(), out);
}

相关文章

微信公众号

最新文章

更多