Skip to content

Fix incorrect usage of Encoder.Parameters in README#220

Merged
hyperxpro merged 3 commits into
hyperxpro:mainfrom
MatteoBax:main
Jul 22, 2025
Merged

Fix incorrect usage of Encoder.Parameters in README#220
hyperxpro merged 3 commits into
hyperxpro:mainfrom
MatteoBax:main

Conversation

@MatteoBax

Copy link
Copy Markdown
Contributor

Motivation:

The current README contains an invalid example in the “Compressing a stream” section. It uses
new Encoder.Parameters.create(4);, which does not exist in the actual API.

Modification:

I updated the README to replace:

Encoder.Parameters params = new Encoder.Parameters.create(4);

with the correct, working usage:

Encoder.Parameters params = new Encoder.Parameters().setQuality(4);

Result:

Fixes incorrect documentation in the README.

@hyperxpro

Copy link
Copy Markdown
Owner

Indeed it's a typo, it should be:

Encoder.Parameters params = Encoder.Parameters.create(4);

Can you use this instead?

@MatteoBax

Copy link
Copy Markdown
Contributor Author

Indeed it's a typo, it should be:

Encoder.Parameters params = Encoder.Parameters.create(4);

Can you use this instead?

No. It says "The method create(int) is undefined for the type Encoder.Parameters"

Brotli4j version: 1.18.0
Java version: 21

@hyperxpro

Copy link
Copy Markdown
Owner
image

Works fine though

@MatteoBax

Copy link
Copy Markdown
Contributor Author

I don't know why but I don't have the static method create(int quality) inside the static class Parameters.

@hyperxpro

Copy link
Copy Markdown
Owner

the new keyword should not be there. :D

@MatteoBax

Copy link
Copy Markdown
Contributor Author

Even without new it doesn't change

@hyperxpro

Copy link
Copy Markdown
Owner

That's strange. Can you try it in a new environment? Maybe Github Codespaces?

@MatteoBax

Copy link
Copy Markdown
Contributor Author

Same issue.
immagine

@hyperxpro

Copy link
Copy Markdown
Owner

Got it. See: #196

@hyperxpro

Copy link
Copy Markdown
Owner

I will cut a new release soon.

Comment thread README.md Outdated
@hyperxpro hyperxpro merged commit fcdf58a into hyperxpro:main Jul 22, 2025
@hyperxpro

Copy link
Copy Markdown
Owner

Thanks a lot!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants