Codota Logo
FileResource
Code IndexAdd Codota to your IDE (free)

How to use
FileResource
in
aQute.bnd.osgi

Best Java code snippets using aQute.bnd.osgi.FileResource (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Dictionary d =
  • Codota Iconnew Hashtable()
  • Codota IconBundle bundle;bundle.getHeaders()
  • Codota Iconnew Properties()
  • Smart code suggestions by Codota
}
origin: biz.aQute.bnd/biz.aQute.bnd

private Resource createPomFromFile(File file) throws Exception {
  if (!file.isFile())
    return null;
  return new FileResource(file);
}
origin: biz.aQute.bnd/bndlib

/**
 * Turn a resource into a file so that anything in the conversion is properly caught
 * @param r
 * @throws Exception
 */
public FileResource(Resource r) throws Exception {
  this.file = File.createTempFile("fileresource", ".resource");
  deleteOnClose(true);
  this.file.deleteOnExit();
  IO.copy(r.openInputStream(), this.file);
}
origin: biz.aQute.bnd/bndlib

public Jar(String name, File dirOrFile, Pattern doNotCopy) throws ZipException, IOException {
  this(name);
  source = dirOrFile;
  if (dirOrFile.isDirectory())
    FileResource.build(this, dirOrFile, doNotCopy);
  else if (dirOrFile.isFile()) {
    zipFile = ZipResource.build(this, dirOrFile);
  } else {
    throw new IllegalArgumentException("A Jar can only accept a valid file or directory: " + dirOrFile);
  }
}
origin: biz.aQute/bndlib

static void traverse(Jar jar, int rootlength, File directory, Pattern doNotCopy) {
  if (doNotCopy != null && doNotCopy.matcher(directory.getName()).matches())
    return;
  jar.updateModified(directory.lastModified(), "Dir change");
  File files[] = directory.listFiles();
  for (int i = 0; i < files.length; i++) {
    if (files[i].isDirectory())
      traverse(jar, rootlength, files[i], doNotCopy);
    else {
      String path = files[i].getAbsolutePath().substring(rootlength + 1);
      if (File.separatorChar != '/')
        path = path.replace(File.separatorChar, '/');
      jar.putResource(path, new FileResource(files[i]), true);
    }
  }
}
origin: biz.aQute/bndlib

public void write(OutputStream out) throws Exception {
  FileResource.copy(this, out);
}
origin: biz.aQute/bndlib

public static void build(Jar jar, File directory, Pattern doNotCopy) {
  traverse(jar, directory.getAbsolutePath().length(), directory, doNotCopy);
}
origin: biz.aQute.bnd/biz.aQute.bnd

@Override
public void write(OutputStream out) throws Exception {
  if (buffer != null) {
    IO.copy(buffer(), out);
  } else {
    IO.copy(file, out);
  }
}
origin: biz.aQute.bnd/biz.aQute.bndlib

@SuppressWarnings("resource")
public static Jar fromResource(String name, Resource resource) throws Exception {
  if (resource instanceof JarResource) {
    return ((JarResource) resource).getJar();
  } else if (resource instanceof FileResource) {
    return new Jar(name, ((FileResource) resource).getFile());
  }
  return new Jar(name).buildFromResource(resource);
}
origin: biz.aQute.bnd/bndlib

static void traverse(Jar jar, int rootlength, File directory, Pattern doNotCopy) {
  if (doNotCopy != null && doNotCopy.matcher(directory.getName()).matches())
    return;
  jar.updateModified(directory.lastModified(), "Dir change " + directory);
  File files[] = directory.listFiles();
  for (int i = 0; i < files.length; i++) {
    if (files[i].isDirectory())
      traverse(jar, rootlength, files[i], doNotCopy);
    else {
      String path = files[i].getAbsolutePath().substring(rootlength + 1);
      if (File.separatorChar != '/')
        path = path.replace(File.separatorChar, '/');
      jar.putResource(path, new FileResource(files[i]), true);
    }
  }
}
origin: biz.aQute.bnd/bnd

public void write(OutputStream out) throws Exception {
  copy(this, out);
}
origin: biz.aQute.bnd/bndlib

public static void build(Jar jar, File directory, Pattern doNotCopy) {
  traverse(jar, directory.getAbsolutePath().length(), directory, doNotCopy);
}
origin: biz.aQute.bnd/biz.aQute.bndlib

@Override
public InputStream openInputStream() throws Exception {
  if (buffer != null) {
    return IO.stream(buffer());
  } else {
    return IO.stream(file);
  }
}
origin: biz.aQute.bnd/biz.aQute.bnd

@SuppressWarnings("resource")
public static Jar fromResource(String name, Resource resource) throws Exception {
  if (resource instanceof JarResource) {
    return ((JarResource) resource).getJar();
  } else if (resource instanceof FileResource) {
    return new Jar(name, ((FileResource) resource).getFile());
  }
  return new Jar(name).buildFromResource(resource);
}
origin: biz.aQute.bnd/biz.aQute.repository

private Resource createPomFromFile(File file) throws Exception {
  if (!file.isFile())
    return null;
  return new FileResource(file);
}
origin: biz.aQute.bnd/bnd

static void traverse(Jar jar, int rootlength, File directory, Pattern doNotCopy) {
  if (doNotCopy != null && doNotCopy.matcher(directory.getName()).matches())
    return;
  jar.updateModified(directory.lastModified(), "Dir change " + directory);
  File files[] = directory.listFiles();
  for (int i = 0; i < files.length; i++) {
    if (files[i].isDirectory())
      traverse(jar, rootlength, files[i], doNotCopy);
    else {
      String path = files[i].getAbsolutePath().substring(rootlength + 1);
      if (File.separatorChar != '/')
        path = path.replace(File.separatorChar, '/');
      jar.putResource(path, new FileResource(files[i]), true);
    }
  }
}
origin: biz.aQute.bnd/bnd

/**
 * Turn a resource into a file so that anything in the conversion is properly caught
 * @param r
 * @throws Exception
 */
public FileResource(Resource r) throws Exception {
  this.file = File.createTempFile("fileresource", ".resource");
  deleteOnClose(true);
  this.file.deleteOnExit();
  IO.copy(r.openInputStream(), this.file);
}
origin: biz.aQute/bndlib

public void write(OutputStream out) throws Exception {
  copy(this, out);
}
origin: biz.aQute/bndlib

public Jar(String name, File dirOrFile, Pattern doNotCopy) throws ZipException, IOException {
  this(name);
  source = dirOrFile;
  if (dirOrFile.isDirectory())
    FileResource.build(this, dirOrFile, doNotCopy);
  else if (dirOrFile.isFile()) {
    zipFile = ZipResource.build(this, dirOrFile);
  } else {
    throw new IllegalArgumentException("A Jar can only accept a valid file or directory: " + dirOrFile);
  }
}
origin: biz.aQute.bnd/bnd

public static void build(Jar jar, File directory, Pattern doNotCopy) {
  traverse(jar, directory.getAbsolutePath().length(), directory, doNotCopy);
}
origin: biz.aQute.bnd/biz.aQute.bndlib

@Override
public void write(OutputStream out) throws Exception {
  if (buffer != null) {
    IO.copy(buffer(), out);
  } else {
    IO.copy(file, out);
  }
}
aQute.bnd.osgiFileResource

Javadoc

Resource for a file. This class implementation assumes the file does not change underneath this object.

Most used methods

  • <init>
  • deleteOnClose
  • build
  • copy
  • traverse
  • buffer
  • getFile

Popular in Java

  • Reading from database using SQL prepared statement
  • setContentView (Activity)
  • onRequestPermissionsResult (Fragment)
  • requestLocationUpdates (LocationManager)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • JComboBox (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now