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

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

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

origin: hierynomus/sshj

private Response doRequest(Request req)
    throws IOException {
  return request(req).retrieve(getTimeoutMs(), TimeUnit.MILLISECONDS);
}
origin: hierynomus/sshj

@Override
public void close()
    throws IOException {
  log.debug("Closing `{}`", this);
  requester.request(newRequest(PacketType.CLOSE))
      .retrieve(requester.getTimeoutMs(), TimeUnit.MILLISECONDS)
      .ensureStatusPacketIsOK();
}
origin: hierynomus/sshj

protected Promise<Response, SFTPException> asyncWrite(long fileOffset, byte[] data, int off, int len)
    throws IOException {
  return requester.request(newRequest(PacketType.WRITE)
      .putUInt64(fileOffset)
      .putString(data, off, len)
  );
}
origin: hierynomus/sshj

protected Promise<Response, SFTPException> asyncRead(long fileOffset, int len) throws IOException {
  return requester.request(newRequest(PacketType.READ).putUInt64(fileOffset).putUInt32(len));
}
origin: hierynomus/sshj

public FileAttributes fetchAttributes() throws IOException {
  return requester.request(newRequest(PacketType.FSTAT))
      .retrieve(requester.getTimeoutMs(), TimeUnit.MILLISECONDS)
      .ensurePacketTypeIs(PacketType.ATTRS)
      .readFileAttributes();
}
origin: hierynomus/sshj

public void setAttributes(FileAttributes attrs) throws IOException {
  requester.request(newRequest(PacketType.FSETSTAT).putFileAttributes(attrs))
      .retrieve(requester.getTimeoutMs(), TimeUnit.MILLISECONDS).ensureStatusPacketIsOK();
}
origin: hierynomus/sshj

final Response res = requester.request(newRequest(PacketType.READDIR))
    .retrieve(requester.getTimeoutMs(), TimeUnit.MILLISECONDS);
switch (res.getType()) {
origin: net.schmizz/sshj

private Response doRequest(Request req)
    throws IOException {
  return request(req).retrieve(getTimeoutMs(), TimeUnit.MILLISECONDS);
}
origin: com.hierynomus/sshj

private Response doRequest(Request req)
    throws IOException {
  return request(req).retrieve(getTimeoutMs(), TimeUnit.MILLISECONDS);
}
origin: iterate-ch/cyberduck

  @Override
  public Promise<Response, SFTPException> request(final Request req) throws IOException {
    log(Type.request, String.format("%d %s", req.getRequestID(), req.getType()));
    return super.request(req);
  }
}.init();
origin: com.hierynomus/sshj

protected Promise<Response, SFTPException> asyncWrite(long fileOffset, byte[] data, int off, int len)
    throws IOException {
  return requester.request(newRequest(PacketType.WRITE)
      .putUInt64(fileOffset)
      .putString(data, off, len)
  );
}
origin: com.hierynomus/sshj

@Override
public void close()
    throws IOException {
  log.debug("Closing `{}`", this);
  requester.request(newRequest(PacketType.CLOSE))
      .retrieve(requester.getTimeoutMs(), TimeUnit.MILLISECONDS)
      .ensureStatusPacketIsOK();
}
origin: com.hierynomus/sshj

protected Promise<Response, SFTPException> asyncRead(long fileOffset, int len) throws IOException {
  return requester.request(newRequest(PacketType.READ).putUInt64(fileOffset).putUInt32(len));
}
origin: com.hierynomus/sshj

public FileAttributes fetchAttributes() throws IOException {
  return requester.request(newRequest(PacketType.FSTAT))
      .retrieve(requester.getTimeoutMs(), TimeUnit.MILLISECONDS)
      .ensurePacketTypeIs(PacketType.ATTRS)
      .readFileAttributes();
}
origin: com.hierynomus/sshj

public void setAttributes(FileAttributes attrs) throws IOException {
  requester.request(newRequest(PacketType.FSETSTAT).putFileAttributes(attrs))
      .retrieve(requester.getTimeoutMs(), TimeUnit.MILLISECONDS).ensureStatusPacketIsOK();
}
origin: com.hierynomus/sshj

final Response res = requester.request(newRequest(PacketType.READDIR))
    .retrieve(requester.getTimeoutMs(), TimeUnit.MILLISECONDS);
switch (res.getType()) {
origin: iterate-ch/cyberduck

private Space getSpaceAvailable(SFTPEngine sftp, final Path directory) throws BackgroundException {
  try {
    final Request request = sftp.newExtendedRequest("space-available").putString(directory.getAbsolute());
    final Response response = sftp.request(request).retrieve();
    switch(response.getType()) {
      case EXTENDED_REPLY:
origin: iterate-ch/cyberduck

private Space getSpaceStatVFSOpenSSH(SFTPEngine sftp, final Path directory) throws BackgroundException {
  try {
    final Request request = sftp.newExtendedRequest("statvfs@openssh.com").putString(directory.getAbsolute());
    final Response response = sftp.request(request).retrieve();
    switch(response.getType()) {
      case EXTENDED_REPLY:
        long blockSize = response.readUInt64(); /* file system block size */
        long filesystemBlockSize = response.readUInt64(); /* fundamental fs block size */
        long totalBlocks = response.readUInt64(); /* number of blocks (unit f_frsize) */
        long filesystemFreeBlocks = response.readUInt64(); /* free blocks in file system */
        long blocksAvailable = response.readUInt64(); /* free blocks for non-root */
        long fileInodes = response.readUInt64(); /* total file inodes */
        long fileInodesFree = response.readUInt64(); /* free file inodes */
        long fileInodesAvailable = response.readUInt64(); /* free file inodes for to non-root */
        byte[] filesystemID = new byte[8]; /* file system id */
        response.readRawBytes(filesystemID);
        long flags = response.readUInt64(); /* bit mask of f_flag values */
        long maximumFilenameLength = response.readUInt64(); /* maximum filename length */
        long total = totalBlocks * filesystemBlockSize;
        long available = blocksAvailable * filesystemBlockSize;
        long used = total - available;
        return new Space(used, available);
      default:
        throw new IOException(String.format("Unexpected response type %s", response.getType()));
    }
  }
  catch(IOException e) {
    throw new SFTPExceptionMappingService().map("Failure to read attributes of {0}", e, directory);
  }
}
net.schmizz.sshj.sftpSFTPEnginerequest

Popular methods of SFTPEngine

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

Popular in Java

  • Reactive rest calls using spring rest template
  • onCreateOptionsMenu (Activity)
  • getApplicationContext (Context)
  • compareTo (BigDecimal)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Runner (org.openjdk.jmh.runner)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top Vim 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