Merge pull request #1104 from hyperxpro:encode-fix

PiperOrigin-RevId: 595388650
This commit is contained in:
Copybara-Service 2024-01-03 06:49:22 -08:00
commit 0ef82f0c0d

View File

@ -227,7 +227,7 @@ public class Encoder {
int totalOutputSize = 0; int totalOutputSize = 0;
try { try {
encoder.getInputBuffer().put(data, offset, length); encoder.getInputBuffer().put(data, offset, length);
encoder.push(EncoderJNI.Operation.FINISH, data.length); encoder.push(EncoderJNI.Operation.FINISH, length);
while (true) { while (true) {
if (!encoder.isSuccess()) { if (!encoder.isSuccess()) {
throw new IOException("encoding failed"); throw new IOException("encoding failed");