|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
com.maverick.sftp.SftpFileInputStream
An InputStream to read the contents of a remote file.
// Create an SshClient forcing SSH2 connectivity. SshConnector con = SshConnector.getInstance(); con.setSupportedVersions(SshConnector.SSH2); // Connect and authenticate an SshClient Ssh2Client ssh = (Ssh2Client) con.connect(....); .... // Create and initialize an SftpSubsystemChannel SftpSubsystemChannel sftp = new SftpSubsystemChannel(65535, 32768); ssh.openChannel(sftp); sftp.initialize(); SftpFile file = sftp.openFile("foo", SftpSubsystemChannel.OPEN_READ); SftpFileInputStream in = new SftpFileInputStream(file); // Read the data ByteArrayOutputStream out = new ByteArrayOutputStream(); int read; while((read = in.read()) > -1) out.write(read); // Close the file and the stream in.close();
Constructor Summary | |
SftpFileInputStream(SftpFile file)
Creates a new SftpFileInputStream object. |
Method Summary | |
void |
close()
Closes the SFTP file handle. |
protected void |
finalize()
This method will only be available in J2SE builds |
int |
read()
|
int |
read(byte[] buffer,
int offset,
int len)
|
Methods inherited from class java.io.InputStream |
available, mark, markSupported, read, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SftpFileInputStream(SftpFile file) throws SftpStatusException, SshException
file
-
SftpStatusException
SshException
Method Detail |
public int read(byte[] buffer, int offset, int len) throws java.io.IOException
java.io.IOException
public int read() throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
java.io.IOException
protected void finalize() throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |