docs: private static HasInputStream wrap(final HasInputStream hasResourceStream, final boolean doEncode) {
          return new HasInputStream() {
              @Override
              public InputStream getInputStream() throws IOException {
                  return new Base64InputStream(hasResourceStream.getInputStream(), doEncode);
              }
  
              @Override
              public long writeContent(OutputStream outputStream) throws IOException {
                  Base64OutputStream codec = new Base64OutputStream(outputStream, doEncode);
                  try {
                      return hasResourceStream.writeContent(codec);
                  } finally {
                      codec.flush();
                      codec.close();
                  }
              }
          };
      }