Tabnine Logo
IO.rename
Code IndexAdd Tabnine to your IDE (free)

How to use
rename
method
in
aQute.lib.io.IO

Best Java code snippets using aQute.lib.io.IO.rename (Showing top 20 results out of 315)

origin: biz.aQute.bnd/biz.aQute.repository

/**
 * Renames <code>from</code> to <code>to</code> replacing the target file if
 * necessary.
 *
 * @param from source file
 * @param to destination file
 * @throws IOException if the rename operation fails
 */
public static File rename(File from, File to) throws IOException {
  return rename(from.toPath(), to.toPath()).toFile();
}
origin: biz.aQute.bnd/biz.aQute.bndlib

/**
 * Renames <code>from</code> to <code>to</code> replacing the target file if
 * necessary.
 *
 * @param from source file
 * @param to destination file
 * @throws IOException if the rename operation fails
 */
public static File rename(File from, File to) throws IOException {
  return rename(from.toPath(), to.toPath()).toFile();
}
origin: biz.aQute.bnd/biz.aQute.resolve

/**
 * Renames <code>from</code> to <code>to</code> replacing the target file if
 * necessary.
 *
 * @param from source file
 * @param to destination file
 * @throws IOException if the rename operation fails
 */
public static File rename(File from, File to) throws IOException {
  return rename(from.toPath(), to.toPath()).toFile();
}
origin: org.osgi/osgi.enroute.configurer.simple.provider

/**
 * Renames <code>from</code> to <code>to</code> replacing the target file if
 * necessary.
 *
 * @param from source file
 * @param to destination file
 * @throws IOException if the rename operation fails
 */
public static File rename(File from, File to) throws IOException {
  return rename(from.toPath(), to.toPath()).toFile();
}
origin: org.apache.aries.spifly/org.apache.aries.spifly.dynamic.bundle

/**
 * Renames <code>from</code> to <code>to</code> replacing the target file if
 * necessary.
 *
 * @param from source file
 * @param to destination file
 * @throws IOException if the rename operation fails
 */
public static File rename(File from, File to) throws IOException {
  return rename(from.toPath(), to.toPath()).toFile();
}
origin: biz.aQute.bnd/biz.aQute.bnd

/**
 * Renames <code>from</code> to <code>to</code> replacing the target file if
 * necessary.
 *
 * @param from source file
 * @param to destination file
 * @throws IOException if the rename operation fails
 */
public static File rename(File from, File to) throws IOException {
  return rename(from.toPath(), to.toPath()).toFile();
}
origin: org.apache.aries.spifly/org.apache.aries.spifly.dynamic.framework.extension

/**
 * Renames <code>from</code> to <code>to</code> replacing the target file if
 * necessary.
 *
 * @param from source file
 * @param to destination file
 * @throws IOException if the rename operation fails
 */
public static File rename(File from, File to) throws IOException {
  return rename(from.toPath(), to.toPath()).toFile();
}
origin: biz.aQute.bnd/biz.aQute.bnd

private synchronized void save() throws Exception {
  Path index = indexFile.toPath();
  Path tmp = Files.createTempFile(IO.mkdirs(index.getParent()), "index", null);
  try (PrintWriter pw = IO.writer(tmp)) {
    archives.keySet()
      .stream()
      .sorted()
      .forEachOrdered(archive -> pw.println(archive));
  }
  IO.rename(tmp, index);
  lastModified = indexFile.lastModified();
}
origin: biz.aQute.bnd/biz.aQute.repository

private synchronized void save() throws Exception {
  Path index = indexFile.toPath();
  Path tmp = Files.createTempFile(IO.mkdirs(index.getParent()), "index", null);
  try (PrintWriter pw = IO.writer(tmp)) {
    archives.keySet()
      .stream()
      .sorted()
      .forEachOrdered(archive -> pw.println(archive));
  }
  IO.rename(tmp, index);
  lastModified = indexFile.lastModified();
}
origin: biz.aQute.bnd/bndlib

/**
 * Save the index file.
 * 
 * @throws Exception
 */
private void save() throws Exception {
  if (!dirty)
    return;
  File tmp = new File(indexFile.getAbsolutePath() + ".tmp");
  tmp.getParentFile().mkdirs();
  PrintWriter ps = new PrintWriter(tmp, "UTF-8");
  try {
    Formatter frm = new Formatter(ps);
    getIndex().write(frm);
    frm.close();
  }
  finally {
    ps.close();
  }
  IO.rename(tmp, indexFile);
}
origin: biz.aQute.bnd/bnd

/**
 * Save the index file.
 * 
 * @throws Exception
 */
private void save() throws Exception {
  if (!dirty)
    return;
  File tmp = new File(indexFile.getAbsolutePath() + ".tmp");
  tmp.getParentFile().mkdirs();
  PrintWriter ps = new PrintWriter(tmp, "UTF-8");
  try {
    Formatter frm = new Formatter(ps);
    getIndex().write(frm);
    frm.close();
  }
  finally {
    ps.close();
  }
  IO.rename(tmp, indexFile);
}
origin: biz.aQute.bnd/biz.aQute.bndlib

public void save(File location) throws IOException {
  if (location.getName()
    .endsWith(".gz"))
    compress = true;
  IO.mkdirs(location.getParentFile());
  File tmp = IO.createTempFile(location.getParentFile(), "index", ".xml");
  try (OutputStream out = IO.outputStream(tmp)) {
    save(out);
  }
  IO.rename(tmp, location);
}
origin: biz.aQute.bnd/biz.aQute.bnd

public void save(File location) throws IOException {
  if (location.getName()
    .endsWith(".gz"))
    compress = true;
  IO.mkdirs(location.getParentFile());
  File tmp = IO.createTempFile(location.getParentFile(), "index", ".xml");
  try (OutputStream out = IO.outputStream(tmp)) {
    save(out);
  }
  IO.rename(tmp, location);
}
origin: biz.aQute.bnd/biz.aQute.bndlib

/**
 * Save the index file.
 * 
 * @throws Exception
 */
private void save() throws Exception {
  if (!dirty)
    return;
  Path index = indexFile.toPath();
  Path tmp = Files.createTempFile(IO.mkdirs(index.getParent()), "index", null);
  try (PrintWriter ps = IO.writer(tmp); Formatter frm = new Formatter(ps)) {
    getIndex().write(frm);
  }
  IO.rename(tmp, index);
}
origin: biz.aQute.bnd/biz.aQute.bnd

/**
 * Save the index file.
 * 
 * @throws Exception
 */
private void save() throws Exception {
  if (!dirty)
    return;
  Path index = indexFile.toPath();
  Path tmp = Files.createTempFile(IO.mkdirs(index.getParent()), "index", null);
  try (PrintWriter ps = IO.writer(tmp); Formatter frm = new Formatter(ps)) {
    getIndex().write(frm);
  }
  IO.rename(tmp, index);
}
origin: biz.aQute.bnd/biz.aQute.bndlib

if (backup) {
  File bak = new File(file.getAbsolutePath() + ".bak");
  IO.rename(file, bak);
IO.rename(out, file);
origin: org.osgi/osgi.enroute.web.simple.provider

@Override
public File call() {
  try {
    String uri = URLDecoder.decode(path.substring(1), "UTF-8");
    URL url = new URL(uri);
    URLConnection con = url.openConnection();
    con.setConnectTimeout(10000);
    con.setRequestProperty("Accept-Encoding", "deflate, gzip");
    File tmp = IO.createTempFile(cacheFile, "path", ".tmp");
    InputStream in = con.getInputStream();
    String encoding = con.getContentEncoding();
    if ("deflate".equalsIgnoreCase(encoding)) {
      in = new DeflaterInputStream(in);
    } else if ("gzip".equalsIgnoreCase(encoding)) {
      in = new ZipInputStream(in);
    }
    IO.copy(in, tmp);
    IO.rename(tmp, cached);
    cached.setLastModified(con.getLastModified() + 1000);
    return cached;
  }
  catch (Exception e) {
    throw new RuntimeException(new InternalServer500Exception(e));
  }
}
origin: biz.aQute.bnd/biz.aQute.bndlib

  .digest();
if (Arrays.equals(digest, sha)) {
  IO.rename(tmp, path);
} else {
  logger.debug("sha's did not match {}, expected {}, got {}", tmp, Hex.toHexString(sha), digest);
origin: biz.aQute.bnd/biz.aQute.bndlib

File bak = new File(source.getParentFile(), source.getName() + ".bak");
try {
  IO.rename(source, bak);
} catch (IOException e) {
  exception(e, "Could not create backup file %s", bak);
origin: biz.aQute.bnd/biz.aQute.bnd

IO.rename(tmpFile, file);
aQute.lib.ioIOrename

Javadoc

Renames from to to replacing the target file if necessary.

Popular methods of IO

  • copy
  • collect
  • getFile
  • deleteWithException
    Deletes the specified path. Folders are recursively deleted. Throws exception if any of the files co
  • reader
  • store
  • writer
  • delete
    Deletes the specified path. Folders are recursively deleted. If file(s) cannot be deleted, no feedba
  • read
  • isSymbolicLink
  • stream
  • traverse
  • stream,
  • traverse,
  • close,
  • createSymbolicLink,
  • createSymbolicLinkOrCopy,
  • createTempFile,
  • decode,
  • mkdirs,
  • normalizePath

Popular in Java

  • Parsing JSON documents to java classes using gson
  • addToBackStack (FragmentTransaction)
  • findViewById (Activity)
  • getExternalFilesDir (Context)
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now