code: @Override
    public void close() throws IOException {
      if (mClosed.getAndSet(true)) {
        return;
      }
      mLocalOutputStream.close();
      try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(mFile))) {
        ObjectMetadata objMeta = new ObjectMetadata();
        objMeta.setContentLength(mFile.length());
        if (mHash != null) {
          byte[] hashBytes = mHash.digest();
          objMeta.setContentMD5(new String(Base64.encodeBase64(hashBytes)));
        }
        mOssClient.putObject(mBucketName, mKey, in, objMeta);
      } catch (ServiceException e) {
        LOG.error("Failed to upload {}. Temporary file @ {}", mKey, mFile.getPath());
        throw new IOException(e);
      }
      mFile.delete();
    }
docs: Closes this output stream. When an output stream is closed, the local temporary file is
  uploaded to OSS Service. Once the file is uploaded, the temporary file is deleted.