-
- Functions, Files, List, Numbers Primitive Streams, Texts, Threads, Valids, Koreans
내용 준비중
- simple
FTP.sftp("test.rebex.net", 22, "demo", "password").open() .use { ftp -> println("sftp opened!!") println("pwd: ${ftp.pwd()}") ftp.listFiles().forEach { println("file: $it") } assert(true) }
- with custom options
FTP.sftp("test.rebex.net", 22, "demo", "password") .beforeConnect { it.timeout = 120000; } .open() .use { ftp -> println("sftp opened!!") println("pwd: ${ftp.pwd()}") ftp.listFiles().forEach { println("file: $it") } assert(true) }
- public key
Ftp.sftp("public-key.test.com", 22) .userPublicKey("demo", "/user/.ssh/id_rsa") .beforeConnect { it.timeout = 120000; } .open() .use { ftp -> println("sftp opened!!") println("pwd: ${ftp.pwd()}") ftp.listFiles().forEach { println("file: $it") } assert(true) }
- simple
try (Ftp ftp = Ftp.sftp("test.rebex.net", 22, "demo", "password").open()) { System.out.println("sftp opened!!"); System.out.println("pwd: " + ftp.pwd()); ftp.listFiles().forEach( it -> System.out.println("file: " + it) ); assert(true); }
- with custom options
try ( Ftp ftp = Ftp .sftp("test.rebex.net", 22, "demo", "password") .beforeConnect { it.timeout = 120000; } .open() ) { System.out.println("sftp opened!!"); System.out.println("pwd: " + ftp.pwd()); ftp.listFiles().forEach( it -> System.out.println("file: " + it) ); assert(true); }
- public key
try ( Ftp ftp = Ftp .sftp("public-key.test.com", 22) .userPublicKey("demo", "/user/.ssh/id_rsa") .open() ) { System.out.println("sftp opened!!"); System.out.println("pwd: " + ftp.pwd()); ftp.listFiles().forEach( it -> System.out.println("file: " + it) ); assert(true); }