Tabnine Logo
SFTPEngine.makeDir
Code IndexAdd Tabnine to your IDE (free)

How to use
makeDir
method
in
net.schmizz.sshj.sftp.SFTPEngine

Best Java code snippets using net.schmizz.sshj.sftp.SFTPEngine.makeDir (Showing top 11 results out of 315)

origin: hierynomus/sshj

public void makeDir(String path)
    throws IOException {
  makeDir(path, FileAttributes.EMPTY);
}
origin: hierynomus/sshj

public void mkdir(String dirname)
    throws IOException {
  engine.makeDir(dirname);
}
origin: hierynomus/sshj

private boolean makeDirIfNotExists(final String remote) throws IOException {
  try {
    FileAttributes attrs = engine.stat(remote);
    if (attrs.getMode().getType() != FileMode.Type.DIRECTORY) {
      throw new IOException(remote + " exists and should be a directory, but was a " + attrs.getMode().getType());
    }
    // Was not created, but existed.
    return false;
  } catch (SFTPException e) {
    if (e.getStatusCode() == StatusCode.NO_SUCH_FILE) {
      log.debug("makeDir: {} does not exist, creating", remote);
      engine.makeDir(remote);
      return true;
    } else {
      throw e;
    }
  }
}
origin: hierynomus/sshj

  @Test
  public void doesNotTryToCreateDirectoryTwiceWhenPathHasTrailingSeparator() throws Exception {
    SFTPClient client = new SFTPClient(sftpEngine);
    client.mkdirs("/folder/directory/");
    verify(sftpEngine, times(1)).makeDir("/folder/directory");
  }
}
origin: net.schmizz/sshj

public void makeDir(String path)
    throws IOException {
  makeDir(path, FileAttributes.EMPTY);
}
origin: net.schmizz/sshj

public void mkdir(String dirname)
    throws IOException {
  engine.makeDir(dirname);
}
origin: com.hierynomus/sshj

public void mkdir(String dirname)
    throws IOException {
  engine.makeDir(dirname);
}
origin: com.hierynomus/sshj

public void makeDir(String path)
    throws IOException {
  makeDir(path, FileAttributes.EMPTY);
}
origin: com.hierynomus/sshj

private boolean makeDirIfNotExists(final String remote) throws IOException {
  try {
    FileAttributes attrs = engine.stat(remote);
    if (attrs.getMode().getType() != FileMode.Type.DIRECTORY) {
      throw new IOException(remote + " exists and should be a directory, but was a " + attrs.getMode().getType());
    }
    // Was not created, but existed.
    return false;
  } catch (SFTPException e) {
    if (e.getStatusCode() == StatusCode.NO_SUCH_FILE) {
      log.debug("makeDir: {} does not exist, creating", remote);
      engine.makeDir(remote);
      return true;
    } else {
      throw e;
    }
  }
}
origin: net.schmizz/sshj

private String prepareDir(final LocalSourceFile local, final String remote)
    throws IOException {
  final FileAttributes attrs;
  try {
    attrs = engine.stat(remote);
  } catch (SFTPException e) {
    if (e.getStatusCode() == StatusCode.NO_SUCH_FILE) {
      log.debug("probeDir: {} does not exist, creating", remote);
      engine.makeDir(remote);
      return remote;
    } else
      throw e;
  }
  if (attrs.getMode().getType() == FileMode.Type.DIRECTORY)
    if (engine.getPathHelper().getComponents(remote).getName().equals(local.getName())) {
      log.debug("probeDir: {} already exists", remote);
      return remote;
    } else {
      log.debug("probeDir: {} already exists, path adjusted for {}", remote, local.getName());
      return prepareDir(local, engine.getPathHelper().adjustForParent(remote, local.getName()));
    }
  else
    throw new IOException(attrs.getMode().getType() + " file already exists at " + remote);
}
origin: iterate-ch/cyberduck

@Override
public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException {
  try {
    final FileAttributes attrs;
    if(Permission.EMPTY != status.getPermission()) {
      attrs = new FileAttributes.Builder().withPermissions(Integer.parseInt(status.getPermission().getMode(), 8)).build();
    }
    else {
      attrs = FileAttributes.EMPTY;
    }
    session.sftp().makeDir(folder.getAbsolute(), attrs);
  }
  catch(IOException e) {
    throw new SFTPExceptionMappingService().map("Cannot create folder {0}", e, folder);
  }
  return new Path(folder.getParent(), folder.getName(), folder.getType(), new SFTPAttributesFinderFeature(session).find(folder));
}
net.schmizz.sshj.sftpSFTPEnginemakeDir

Popular methods of SFTPEngine

  • open
  • stat
  • <init>
  • canonicalize
  • close
  • getOperativeProtocolVersion
  • getPathHelper
  • getSubsystem
  • init
  • lstat
  • openDir
  • readLink
  • openDir,
  • readLink,
  • remove,
  • removeDir,
  • rename,
  • request,
  • setAttributes,
  • symlink,
  • doRequest

Popular in Java

  • Reading from database using SQL prepared statement
  • putExtra (Intent)
  • compareTo (BigDecimal)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Path (java.nio.file)
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Top plugins for WebStorm
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