Make OneDimensionalCodeWriter.encode(content, hints) public (#1659)

This method is useful for encoding Code128 with a specific code set to a bool array. As no other class overrides this method, this change only affects Code128Writer.

I don't know that there's a strong argument against making this method public. With this method protected, it is necessary to first encode as a BitMatrix, extract the first row, and the convert the resulting BitArray to a bool array. This all can be avoided if the method is made public.
This commit is contained in:
primo-ppcg 2023-06-24 19:42:40 +07:00 committed by GitHub
parent 7880290d25
commit 57ed027468
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -71,7 +71,7 @@ public final class Code128Writer extends OneDimensionalCodeWriter {
}
@Override
protected boolean[] encode(String contents, Map<EncodeHintType,?> hints) {
public boolean[] encode(String contents, Map<EncodeHintType,?> hints) {
int forcedCodeSet = check(contents, hints);

View file

@ -48,7 +48,7 @@ public abstract class OneDimensionalCodeWriter implements Writer {
* @param hints encoding hints
* @return a {@code boolean[]} of horizontal pixels (false = white, true = black)
*/
protected boolean[] encode(String contents, Map<EncodeHintType,?> hints) {
public boolean[] encode(String contents, Map<EncodeHintType,?> hints) {
return encode(contents);
}