Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README: Incorrect addFolder with ExcludeFileFilter example #222

Closed
constructor-s opened this issue Jul 23, 2020 · 2 comments
Closed

README: Incorrect addFolder with ExcludeFileFilter example #222

constructor-s opened this issue Jul 23, 2020 · 2 comments

Comments

@constructor-s
Copy link

zip4j/README.md

Lines 97 to 104 in bc8e344

Since v2.6, it is possible to exclude certain files when adding a folder to zip by using an ExcludeFileFilter
~~~~
List<File> filesToExclude = Arrays.asList(new File("sample.pdf"), new File("sample_2.txt"));
ExcludeFileFilter excludeFileFilter = filesToExclude::contains;
new ZipFile("filename.zip").addFolder(new File("/user/myuser/folder_to_add"), new ZipParameters, excludeFileFilter);
~~~~

Clearly, ..., new ZipParameters, ...); is not proper Java syntax with constructor called without brackets (unless I am missing some new Java features...)

I guess it should be:?

ExcludeFileFilter excludeFileFilter = filesToExclude::contains;
ZipParameters zipParameters = new ZipParameters();
zipParameters.setExcludeFileFilter(excludeFileFilter);
new ZipFile("filename.zip").addFolder(new File("/user/myuser/folder_to_add"), zipParameters);
@srikanth-lingala
Copy link
Owner

Thanks for pointing it out. I fixed it.

@srikanth-lingala
Copy link
Owner

Issue fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants