Povilas Jegelevičius
Povilas Jegelevičius

Reputation: 33

Sftp adapter file size limit

I need to filter out files that are too large (1MB) before downloading from remote SFTP server.

What kind of filter should I use? Is it possible to check file size before download (and if it is too large send an Error)?

Upvotes: 1

Views: 514

Answers (1)

Povilas Jegelevičius
Povilas Jegelevičius

Reputation: 33

I found answer.

private FileListFilter<ChannelSftp.LsEntry> filter() {
    return files -> Arrays.stream(files)
            .filter(file -> file.getAttrs().getSize() < 0)
            .collect(Collectors.toList());
}

Upvotes: 1

Related Questions