Package com.sshtools.j2ssh.sftp
Class SftpSubsystemClient
- java.lang.Object
-
- com.sshtools.j2ssh.connection.Channel
-
- com.sshtools.j2ssh.subsystem.SubsystemChannel
-
- com.sshtools.j2ssh.sftp.SftpSubsystemClient
-
public class SftpSubsystemClient extends SubsystemChannel
- Version:
- $Revision: 1.38 $
- Author:
- $author$
-
-
Field Summary
Fields Modifier and Type Field Description static int
OPEN_APPEND
static int
OPEN_CREATE
static int
OPEN_EXCLUSIVE
static int
OPEN_READ
static int
OPEN_TRUNCATE
static int
OPEN_WRITE
static int
VERSION_1
static int
VERSION_2
static int
VERSION_3
static int
VERSION_4
-
Fields inherited from class com.sshtools.j2ssh.connection.Channel
connection, localChannelId, localPacketSize, localWindow, remoteChannelId, remotePacketSize, remoteWindow, state
-
-
Constructor Summary
Constructors Constructor Description SftpSubsystemClient()
Creates a new SftpSubsystemClient object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected long
availableWindowSpace()
void
changePermissions(SftpFile file, int permissions)
void
changePermissions(SftpFile file, java.lang.String permissions)
void
changePermissions(java.lang.String filename, int permissions)
void
changePermissions(java.lang.String filename, java.lang.String permissions)
void
closeFile(SftpFile file)
protected void
closeHandle(byte[] handle)
void
createSymbolicLink(java.lang.String targetpath, java.lang.String linkpath)
java.lang.String
getAbsolutePath(SftpFile file)
java.lang.String
getAbsolutePath(java.lang.String path)
FileAttributes
getAttributes(SftpFile file)
FileAttributes
getAttributes(java.lang.String path)
java.lang.String
getDefaultDirectory()
protected int
getMaximumPacketSize()
protected int
getMaximumWindowSpace()
protected int
getMinimumWindowSpace()
java.lang.String
getName()
java.lang.String
getSymbolicLinkTarget(java.lang.String linkpath)
boolean
initialize()
protected boolean
isValidHandle(byte[] handle)
int
listChildren(SftpFile file, java.util.List children)
void
makeDirectory(java.lang.String path)
protected long
maximumPacketSize()
SftpFile
openDirectory(java.lang.String path)
SftpFile
openFile(java.lang.String filename, int flags)
SftpFile
openFile(java.lang.String absolutePath, int flags, FileAttributes attrs)
protected int
readFile(byte[] handle, UnsignedInteger64 offset, byte[] output, int off, int len)
void
recurseMakeDirectory(java.lang.String path)
void
removeDirectory(java.lang.String path)
void
removeFile(java.lang.String filename)
void
renameFile(java.lang.String oldpath, java.lang.String newpath)
void
setAttributes(SftpFile file, FileAttributes attrs)
void
setAttributes(java.lang.String path, FileAttributes attrs)
protected void
writeFile(byte[] handle, UnsignedInteger64 offset, byte[] data, int off, int len)
-
Methods inherited from class com.sshtools.j2ssh.subsystem.SubsystemChannel
getChannelConfirmationData, getChannelOpenData, getChannelType, onChannelClose, onChannelData, onChannelEOF, onChannelExtData, onChannelOpen, onChannelRequest, sendMessage, startSubsystem
-
Methods inherited from class com.sshtools.j2ssh.connection.Channel
addEventListener, close, finalizeClose, getLocalChannelId, getLocalPacketSize, getLocalWindow, getRemoteChannelId, getRemotePacketSize, getRemoteWindow, getState, init, init, isClosed, isLocalEOF, isOpen, isRemoteEOF, open, processChannelData, processChannelData, remoteClose, sendChannelData, sendChannelExtData, setLocalEOF, setName, setRemoteEOF
-
-
-
-
Field Detail
-
OPEN_READ
public static final int OPEN_READ
- See Also:
- Constant Field Values
-
OPEN_WRITE
public static final int OPEN_WRITE
- See Also:
- Constant Field Values
-
OPEN_APPEND
public static final int OPEN_APPEND
- See Also:
- Constant Field Values
-
OPEN_CREATE
public static final int OPEN_CREATE
- See Also:
- Constant Field Values
-
OPEN_TRUNCATE
public static final int OPEN_TRUNCATE
- See Also:
- Constant Field Values
-
OPEN_EXCLUSIVE
public static final int OPEN_EXCLUSIVE
- See Also:
- Constant Field Values
-
VERSION_1
public static final int VERSION_1
- See Also:
- Constant Field Values
-
VERSION_2
public static final int VERSION_2
- See Also:
- Constant Field Values
-
VERSION_3
public static final int VERSION_3
- See Also:
- Constant Field Values
-
VERSION_4
public static final int VERSION_4
- See Also:
- Constant Field Values
-
-
Method Detail
-
availableWindowSpace
protected long availableWindowSpace()
- Returns:
-
maximumPacketSize
protected long maximumPacketSize()
- Returns:
-
closeHandle
protected void closeHandle(byte[] handle) throws java.io.IOException
- Parameters:
handle
-- Throws:
java.io.IOException
-
closeFile
public void closeFile(SftpFile file) throws java.io.IOException
- Parameters:
file
-- Throws:
java.io.IOException
-
isValidHandle
protected boolean isValidHandle(byte[] handle)
- Parameters:
handle
-- Returns:
-
listChildren
public int listChildren(SftpFile file, java.util.List children) throws java.io.IOException
- Parameters:
file
-children
-- Returns:
- Throws:
java.io.IOException
-
makeDirectory
public void makeDirectory(java.lang.String path) throws java.io.IOException
- Parameters:
path
-- Throws:
java.io.IOException
-
recurseMakeDirectory
public void recurseMakeDirectory(java.lang.String path) throws java.io.IOException
- Parameters:
path
-- Throws:
java.io.IOException
-
openDirectory
public SftpFile openDirectory(java.lang.String path) throws java.io.IOException
- Parameters:
path
-- Returns:
- Throws:
java.io.IOException
-
getDefaultDirectory
public java.lang.String getDefaultDirectory() throws java.io.IOException
- Returns:
- Throws:
java.io.IOException
-
getAbsolutePath
public java.lang.String getAbsolutePath(java.lang.String path) throws java.io.IOException
- Parameters:
path
-- Returns:
- Throws:
java.io.IOException
-
getAbsolutePath
public java.lang.String getAbsolutePath(SftpFile file) throws java.io.IOException
- Parameters:
file
-- Returns:
- Throws:
java.io.IOException
-
openFile
public SftpFile openFile(java.lang.String filename, int flags) throws java.io.IOException
- Parameters:
filename
-flags
-- Returns:
- Throws:
java.io.IOException
-
openFile
public SftpFile openFile(java.lang.String absolutePath, int flags, FileAttributes attrs) throws java.io.IOException
- Parameters:
absolutePath
-flags
-attrs
-- Returns:
- Throws:
java.io.IOException
-
getAttributes
public FileAttributes getAttributes(java.lang.String path) throws java.io.IOException
- Parameters:
path
-- Returns:
- Throws:
java.io.IOException
-
getAttributes
public FileAttributes getAttributes(SftpFile file) throws java.io.IOException
- Parameters:
file
-- Returns:
- Throws:
java.io.IOException
-
readFile
protected int readFile(byte[] handle, UnsignedInteger64 offset, byte[] output, int off, int len) throws java.io.IOException
- Parameters:
handle
-offset
-output
-off
-len
-- Returns:
- Throws:
java.io.IOException
-
removeDirectory
public void removeDirectory(java.lang.String path) throws java.io.IOException
- Parameters:
path
-- Throws:
java.io.IOException
-
removeFile
public void removeFile(java.lang.String filename) throws java.io.IOException
- Parameters:
filename
-- Throws:
java.io.IOException
-
renameFile
public void renameFile(java.lang.String oldpath, java.lang.String newpath) throws java.io.IOException
- Parameters:
oldpath
-newpath
-- Throws:
java.io.IOException
-
writeFile
protected void writeFile(byte[] handle, UnsignedInteger64 offset, byte[] data, int off, int len) throws java.io.IOException
- Parameters:
handle
-offset
-data
-off
-len
-- Throws:
java.io.IOException
-
createSymbolicLink
public void createSymbolicLink(java.lang.String targetpath, java.lang.String linkpath) throws java.io.IOException
- Parameters:
targetpath
-linkpath
-- Throws:
java.io.IOException
-
getSymbolicLinkTarget
public java.lang.String getSymbolicLinkTarget(java.lang.String linkpath) throws java.io.IOException
- Parameters:
linkpath
-- Returns:
- Throws:
java.io.IOException
-
setAttributes
public void setAttributes(java.lang.String path, FileAttributes attrs) throws java.io.IOException
- Parameters:
path
-attrs
-- Throws:
java.io.IOException
-
setAttributes
public void setAttributes(SftpFile file, FileAttributes attrs) throws java.io.IOException
- Parameters:
file
-attrs
-- Throws:
java.io.IOException
-
changePermissions
public void changePermissions(SftpFile file, java.lang.String permissions) throws java.io.IOException
- Parameters:
file
-permissions
-- Throws:
java.io.IOException
-
changePermissions
public void changePermissions(SftpFile file, int permissions) throws java.io.IOException
- Parameters:
file
-permissions
-- Throws:
java.io.IOException
-
changePermissions
public void changePermissions(java.lang.String filename, int permissions) throws java.io.IOException
- Parameters:
filename
-permissions
-- Throws:
java.io.IOException
-
changePermissions
public void changePermissions(java.lang.String filename, java.lang.String permissions) throws java.io.IOException
- Parameters:
filename
-permissions
-- Throws:
java.io.IOException
-
initialize
public boolean initialize() throws java.io.IOException
- Returns:
- Throws:
java.io.IOException
-
getMinimumWindowSpace
protected int getMinimumWindowSpace()
- Specified by:
getMinimumWindowSpace
in classChannel
- Returns:
-
getMaximumWindowSpace
protected int getMaximumWindowSpace()
- Specified by:
getMaximumWindowSpace
in classChannel
- Returns:
-
getMaximumPacketSize
protected int getMaximumPacketSize()
- Specified by:
getMaximumPacketSize
in classChannel
- Returns:
-
-