Tabnine Logo
net.schmizz.sshj.sftp
Code IndexAdd Tabnine to your IDE (free)

How to use net.schmizz.sshj.sftp

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

origin: hierynomus/sshj

public Builder withType(FileMode.Type type) {
  mask |= Flag.MODE.get();
  this.mode = new FileMode(type.toMask() | (mode != null ? mode.getPermissionsMask() : 0));
  return this;
}
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

public PacketType readType()
    throws SFTPException {
  try {
    return PacketType.fromByte(readByte());
  } catch (BufferException be) {
    throw new SFTPException(be);
  }
}
origin: hierynomus/sshj

public RemoteFile open(String path, Set<OpenMode> modes, FileAttributes fa)
    throws IOException {
  final byte[] handle = doRequest(
      newRequest(PacketType.OPEN).putString(path, sub.getRemoteCharset()).putUInt32(OpenMode.toMask(modes)).putFileAttributes(fa)
  ).ensurePacketTypeIs(PacketType.HANDLE).readBytes();
  return new RemoteFile(this, path, handle);
}
origin: hierynomus/sshj

@Override
public List<RemoteResourceInfo> ls(String path, RemoteResourceFilter filter)
    throws IOException {
  final RemoteDirectory dir = getSFTPEngine().openDir(cwdify(path));
  try {
    return dir.scan(filter);
  } finally {
    dir.close();
  }
}
origin: hierynomus/sshj

private static byte[] readSingleNameAsBytes(Response res)
    throws IOException {
  res.ensurePacketTypeIs(PacketType.NAME);
  if (res.readUInt32AsInt() == 1)
    return res.readStringAsBytes();
  else
    throw new SFTPException("Unexpected data in " + res.getType() + " packet");
}
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

public List<RemoteResourceInfo> ls(String path, RemoteResourceFilter filter)
    throws IOException {
  final RemoteDirectory dir = engine.openDir(path);
  try {
    return dir.scan(filter);
  } finally {
    dir.close();
  }
}
origin: hierynomus/sshj

@Override
public void put(String source, String dest)
    throws IOException {
  super.put(source, cwdify(dest));
}
origin: hierynomus/sshj

public StatusCode readStatusCode()
    throws SFTPException {
  try {
    return StatusCode.fromInt(readUInt32AsInt());
  } catch (BufferException be) {
    throw new SFTPException(be);
  }
}
origin: hierynomus/sshj

private void setAttributes(LocalSourceFile local, String remotePath) throws IOException {
  if (getPreserveAttributes()) {
    engine.setAttributes(remotePath, getAttributes(local));
  }
}
origin: hierynomus/sshj

protected String error(StatusCode sc)
    throws SFTPException {
  try {
    throw new SFTPException(sc, protocolVersion < 3 ? sc.toString() : readString());
  } catch (BufferException be) {
    throw new SFTPException(be);
  }
}
origin: hierynomus/sshj

public Response(Buffer<Response> pk, int protocolVersion)
    throws SFTPException {
  super(pk);
  this.protocolVersion = protocolVersion;
  this.type = readType();
  try {
    this.reqID = readUInt32();
  } catch (BufferException be) {
    throw new SFTPException(be);
  }
}
origin: hierynomus/sshj

public Builder withPermissions(int perms) {
  mask |= Flag.MODE.get();
  this.mode = new FileMode((mode != null ? mode.getTypeMask() : 0) | perms);
  return this;
}
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

@Override
public void mkdirs(String path)
    throws IOException {
  super.mkdirs(cwdify(path));
}
origin: hierynomus/sshj

@Override
public FileAttributes lstat(String path)
    throws IOException {
  return super.lstat(cwdify(path));
}
origin: hierynomus/sshj

@Override
public RemoteFile open(String filename, Set<OpenMode> mode, FileAttributes attrs)
    throws IOException {
  return super.open(cwdify(filename), mode, attrs);
}
origin: hierynomus/sshj

@Override
public void mkdir(String dirname)
    throws IOException {
  super.mkdir(cwdify(dirname));
}
origin: hierynomus/sshj

@Override
public String canonicalize(String path)
    throws IOException {
  return super.canonicalize(cwdify(path));
}
net.schmizz.sshj.sftp

Most used classes

  • SFTPClient
  • SFTPEngine
  • RemoteFile
  • FileAttributes$Builder
  • FileMode
  • SFTPException,
  • FileAttributes,
  • FileMode$Type,
  • PathHelper,
  • RemoteDirectory,
  • RemoteFile$ReadAheadRemoteFileInputStream,
  • RemoteResourceInfo,
  • Request,
  • Response,
  • SFTPPacket,
  • FileAttributes$Flag,
  • OpenMode,
  • PacketType,
  • PathComponents
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