public void onComplete()

in src/main/java/software/amazon/encryption/s3/internal/BufferedCipherSubscriber.java [118:140]


    public void onComplete() {
        if (doneFinal.get()) {
            // doFinal has already been called, bail out
            return;
        }
        try {
            outputBuffer = cipher.doFinal();
            doneFinal.set(true);
            // Once doFinal is called, then we can release the plaintext
            if (contentRead.get() == contentLength) {
                while (!buffers.isEmpty()) {
                    wrappedSubscriber.onNext(buffers.remove());
                }
            }
            // Send the final bytes to the wrapped subscriber
            wrappedSubscriber.onNext(ByteBuffer.wrap(outputBuffer));
        } catch (final GeneralSecurityException exception) {
            // Forward error, else the wrapped subscriber waits indefinitely
            wrappedSubscriber.onError(exception);
            throw new S3EncryptionClientSecurityException(exception.getMessage(), exception);
        }
        wrappedSubscriber.onComplete();
    }