code: public void close() throws IOException {
          if (closed) {
              return;
          }
  
          closed = true;
          try {
              obuffer = cipher.doFinal();
          } catch (IllegalBlockSizeException | BadPaddingException e) {
              obuffer = null;
              // Android-added: Throw an exception when the underlying cipher does.  http://b/36636576
              throw new IOException(e);
          }
          try {
              flush();
          } catch (IOException ignored) {}
          out.close();
      }
docs: Closes this output stream and releases any system resources
  associated with this stream.
  <p>
  This method invokes the <code>doFinal</code> method of the encapsulated
  cipher object, which causes any bytes buffered by the encapsulated
  cipher to be processed. The result is written out by calling the
  <code>flush</code> method of this output stream.
  <p>
  This method resets the encapsulated cipher object to its initial state
  and calls the <code>close</code> method of the underlying output
  stream.
  
  @exception  IOException  if an I/O error occurs.
  @since      JCE1.2