-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support premature termination of listing
- Loading branch information
1 parent
c0d1519
commit 56e9dc2
Showing
6 changed files
with
153 additions
and
32 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
src/main/java/com/hierynomus/sshj/sftp/RemoteResourceFilterConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.hierynomus.sshj.sftp; | ||
|
||
import com.hierynomus.sshj.sftp.RemoteResourceSelector.Result; | ||
import net.schmizz.sshj.sftp.RemoteResourceFilter; | ||
|
||
public class RemoteResourceFilterConverter { | ||
|
||
public static RemoteResourceSelector selectorFrom(RemoteResourceFilter filter) { | ||
return resource -> filter.accept(resource) ? Result.ACCEPT : Result.CONTINUE; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/com/hierynomus/sshj/sftp/RemoteResourceSelector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.hierynomus.sshj.sftp; | ||
|
||
import net.schmizz.sshj.sftp.RemoteResourceInfo; | ||
|
||
public interface RemoteResourceSelector { | ||
|
||
enum Result { | ||
/** | ||
* Accept the remote resource and add it to the result. | ||
*/ | ||
ACCEPT, | ||
|
||
/** | ||
* Do not add the remote resource to the result and continue with the next. | ||
*/ | ||
CONTINUE, | ||
|
||
/** | ||
* Do not add the remote resource to the result and stop further execution. | ||
*/ | ||
BREAK; | ||
} | ||
|
||
/** | ||
* Decide whether the remote resource should be included in the result and whether execution should continue. | ||
*/ | ||
Result select(RemoteResourceInfo resource); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters