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

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

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

origin: hierynomus/sshj

public FileAttributes stat(String path)
    throws IOException {
  return engine.stat(path);
}
origin: hierynomus/sshj

public FileAttributes stat(String path)
    throws IOException {
  return stat(PacketType.STAT, path);
}
origin: hierynomus/sshj

public FileAttributes lstat(String path)
    throws IOException {
  return stat(PacketType.LSTAT, path);
}
origin: hierynomus/sshj

public FileAttributes statExistence(String path)
    throws IOException {
  try {
    return engine.stat(path);
  } catch (SFTPException sftpe) {
    if (sftpe.getStatusCode() == Response.StatusCode.NO_SUCH_FILE) {
      return null;
    } else {
      throw sftpe;
    }
  }
}
origin: hierynomus/sshj

private boolean isDirectory(final String remote) throws IOException {
  try {
    FileAttributes attrs = engine.stat(remote);
    return attrs.getMode().getType() == FileMode.Type.DIRECTORY;
  } catch (SFTPException e) {
    if (e.getStatusCode() == StatusCode.NO_SUCH_FILE) {
      log.debug("isDir: {} does not exist", remote);
      return false;
    } else {
      throw e;
    }
  }
}
origin: hierynomus/sshj

private String prepareFile(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("probeFile: {} does not exist", remote);
      return remote;
    } else
      throw e;
  }
  if (attrs.getMode().getType() == FileMode.Type.DIRECTORY) {
    throw new IOException("Trying to upload file " + local.getName() + " to path " + remote + " but that is a directory");
  } else {
    log.debug("probeFile: {} is a {} file that will be replaced", remote, attrs.getMode().getType());
    return remote;
  }
}
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

@Before
public void setRemoteWorkingDirectory() throws IOException {
  FileAttributes isADirectory = new FileAttributes.Builder().withType(FileMode.Type.DIRECTORY).build();
  when(sftpEngine.stat("/workingdirectory")).thenReturn(isADirectory);
}
origin: hierynomus/sshj

@Override
public void download(String source, LocalDestFile dest) throws IOException {
  final PathComponents pathComponents = engine.getPathHelper().getComponents(source);
  final FileAttributes attributes = engine.stat(source);
  new Downloader().download(getTransferListener(), new RemoteResourceInfo(pathComponents, attributes), dest);
}
origin: hierynomus/sshj

@Before
public void setPathHelper() throws Exception {
  PathHelper helper = new PathHelper(new PathHelper.Canonicalizer() {
    /**
     * Very basic, it does not try to canonicalize relative bits in the middle of a path.
     */
    @Override
    public String canonicalize(String path)
        throws IOException {
      if ("".equals(path) || ".".equals(path) || "./".equals(path))
        return "/home/me";
      if ("..".equals(path) || "../".equals(path))
        return "/home";
      return path;
    }
  }, DEFAULT_PATH_SEPARATOR);
  when(sftpEngine.getPathHelper()).thenReturn(helper);
  when(sftpEngine.stat("/")).thenReturn(new FileAttributes.Builder().withType(FileMode.Type.DIRECTORY).build());
  when(sftpEngine.getLoggerFactory()).thenReturn(LoggerFactory.DEFAULT);
}
origin: net.schmizz/sshj

public FileAttributes stat(String path)
    throws IOException {
  return stat(PacketType.STAT, path);
}
origin: com.hierynomus/sshj

public FileAttributes lstat(String path)
    throws IOException {
  return stat(PacketType.LSTAT, path);
}
origin: net.schmizz/sshj

public FileAttributes lstat(String path)
    throws IOException {
  return stat(PacketType.LSTAT, path);
}
origin: net.schmizz/sshj

public FileAttributes stat(String path)
    throws IOException {
  return engine.stat(path);
}
origin: com.hierynomus/sshj

public FileAttributes stat(String path)
    throws IOException {
  return stat(PacketType.STAT, path);
}
origin: net.schmizz/sshj

public FileAttributes statExistence(String path)
    throws IOException {
  try {
    return engine.stat(path);
  } catch (SFTPException sftpe) {
    if (sftpe.getStatusCode() == Response.StatusCode.NO_SUCH_FILE) {
      return null;
    } else {
      throw sftpe;
    }
  }
}
origin: com.hierynomus/sshj

public FileAttributes statExistence(String path)
    throws IOException {
  try {
    return engine.stat(path);
  } catch (SFTPException sftpe) {
    if (sftpe.getStatusCode() == Response.StatusCode.NO_SUCH_FILE) {
      return null;
    } else {
      throw sftpe;
    }
  }
}
origin: com.hierynomus/sshj

private boolean isDirectory(final String remote) throws IOException {
  try {
    FileAttributes attrs = engine.stat(remote);
    return attrs.getMode().getType() == FileMode.Type.DIRECTORY;
  } catch (SFTPException e) {
    if (e.getStatusCode() == StatusCode.NO_SUCH_FILE) {
      log.debug("isDir: {} does not exist", remote);
      return false;
    } else {
      throw e;
    }
  }
}
origin: net.schmizz/sshj

@Override
public void download(String source, LocalDestFile dest)
    throws IOException {
  final PathComponents pathComponents = engine.getPathHelper().getComponents(source);
  final FileAttributes attributes = engine.stat(source);
  new Downloader().download(getTransferListener(), new RemoteResourceInfo(pathComponents, attributes), dest);
}
origin: com.hierynomus/sshj

@Override
public void download(String source, LocalDestFile dest) throws IOException {
  final PathComponents pathComponents = engine.getPathHelper().getComponents(source);
  final FileAttributes attributes = engine.stat(source);
  new Downloader().download(getTransferListener(), new RemoteResourceInfo(pathComponents, attributes), dest);
}
net.schmizz.sshj.sftpSFTPEnginestat

Popular methods of SFTPEngine

  • open
  • makeDir
  • <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
  • runOnUiThread (Activity)
  • findViewById (Activity)
  • getApplicationContext (Context)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • JPanel (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • 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