protected Request newRequest(PacketType type) { return requester.newRequest(type).putString(handle); }
public Request newExtendedRequest(String reqName) { return newRequest(PacketType.EXTENDED).putString(reqName); }
public void symlink(String linkpath, String targetpath) throws IOException { if (operativeVersion < 3) throw new SFTPException("SYMLINK is not supported in SFTPv" + operativeVersion); doRequest( newRequest(PacketType.SYMLINK).putString(linkpath, sub.getRemoteCharset()).putString(targetpath, sub.getRemoteCharset()) ).ensureStatusPacketIsOK(); }
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) ); }
public void rename(String oldPath, String newPath) throws IOException { if (operativeVersion < 1) throw new SFTPException("RENAME is not supported in SFTPv" + operativeVersion); doRequest( newRequest(PacketType.RENAME).putString(oldPath, sub.getRemoteCharset()).putString(newPath, sub.getRemoteCharset()) ).ensureStatusPacketIsOK(); }
public void remove(String filename) throws IOException { doRequest( newRequest(PacketType.REMOVE).putString(filename, sub.getRemoteCharset()) ).ensureStatusPacketIsOK(); }
public void removeDir(String path) throws IOException { doRequest( newRequest(PacketType.RMDIR).putString(path, sub.getRemoteCharset()) ).ensureStatusIs(Response.StatusCode.OK); }
protected FileAttributes stat(PacketType pt, String path) throws IOException { return doRequest(newRequest(pt).putString(path, sub.getRemoteCharset())) .ensurePacketTypeIs(PacketType.ATTRS) .readFileAttributes(); }
public void setAttributes(String path, FileAttributes attrs) throws IOException { doRequest( newRequest(PacketType.SETSTAT).putString(path, sub.getRemoteCharset()).putFileAttributes(attrs) ).ensureStatusPacketIsOK(); }
public String canonicalize(String path) throws IOException { return readSingleName( doRequest( newRequest(PacketType.REALPATH).putString(path, sub.getRemoteCharset()) ), sub.getRemoteCharset()); }
public void makeDir(String path, FileAttributes attrs) throws IOException { doRequest(newRequest(PacketType.MKDIR).putString(path, sub.getRemoteCharset()).putFileAttributes(attrs)).ensureStatusPacketIsOK(); }
public RemoteDirectory openDir(String path) throws IOException { final byte[] handle = doRequest( newRequest(PacketType.OPENDIR).putString(path, sub.getRemoteCharset()) ).ensurePacketTypeIs(PacketType.HANDLE).readBytes(); return new RemoteDirectory(this, path, handle); }
public String readLink(String path) throws IOException { if (operativeVersion < 3) throw new SFTPException("READLINK is not supported in SFTPv" + operativeVersion); return readSingleName( doRequest( newRequest(PacketType.READLINK).putString(path, sub.getRemoteCharset()) ), sub.getRemoteCharset()); }
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); }
public void setAttributes(String path, FileAttributes attrs) throws IOException { doRequest( newRequest(PacketType.SETSTAT).putString(path).putFileAttributes(attrs) ).ensureStatusPacketIsOK(); }
public String readLink(String path) throws IOException { if (operativeVersion < 3) throw new SFTPException("READLINK is not supported in SFTPv" + operativeVersion); return readSingleName( doRequest( newRequest(PacketType.READLINK).putString(path) )); }
public void setAttributes(String path, FileAttributes attrs) throws IOException { doRequest( newRequest(PacketType.SETSTAT).putString(path, sub.getRemoteCharset()).putFileAttributes(attrs) ).ensureStatusPacketIsOK(); }
public RemoteDirectory openDir(String path) throws IOException { final byte[] handle = doRequest( newRequest(PacketType.OPENDIR).putString(path, sub.getRemoteCharset()) ).ensurePacketTypeIs(PacketType.HANDLE).readBytes(); return new RemoteDirectory(this, path, handle); }
public RemoteFile open(String path, Set<OpenMode> modes, FileAttributes fa) throws IOException { final String handle = doRequest( newRequest(PacketType.OPEN).putString(path).putUInt32(OpenMode.toMask(modes)).putFileAttributes(fa) ).ensurePacketTypeIs(PacketType.HANDLE).readString(); return new RemoteFile(this, path, handle); }