code: @Nonnull
    public static String encodeObject (@Nonnull final Serializable aSerializableObject,
                                       final int nOptions) throws IOException
    {
      ValueEnforcer.notNull (aSerializableObject, "Object");
  
      // ObjectOutputStream -> (GZIP) -> Base64 -> ByteArrayOutputStream
      final NonBlockingByteArrayOutputStream baos = new NonBlockingByteArrayOutputStream ();
      try (final Base64OutputStream b64os = new Base64OutputStream (baos, ENCODE | nOptions))
      {
        if ((nOptions & GZIP) != 0)
        {
          // Gzip
          try (GZIPOutputStream gzos = new GZIPOutputStream (b64os);
              ObjectOutputStream oos = new ObjectOutputStream (gzos))
          {
            oos.writeObject (aSerializableObject);
          }
        }
        else
        {
          // Not gzipped
          try (ObjectOutputStream oos = new ObjectOutputStream (b64os))
          {
            oos.writeObject (aSerializableObject);
          }
        }
      }
  
      // Return value according to relevant encoding.
      return baos.getAsString (PREFERRED_ENCODING);
    }
docs: Serializes an object and returns the Base64-encoded version of that
  serialized object.
  <p>
  As of v 2.3, if the object cannot be serialized or there is another error,
  the method will throw an IOException. <b>This is new to v2.3!</b> In
  earlier versions, it just returned a null value, but in retrospect that's a
  pretty poor way to handle it.
  </p>
  The object is not GZip-compressed before being encoded.
  <p>
  Example options:
  
  <pre>
  GZIP: gzip-compresses object before encoding it.
  DO_BREAK_LINES: break lines at 76 characters
  </pre>
  <p>
  Example: <code>encodeObject( myObj, Base64.GZIP )</code> or
  <p>
  Example:
  <code>encodeObject( myObj, Base64.GZIP | Base64.DO_BREAK_LINES )</code>
  
  @param aSerializableObject
  The object to encode
  @param nOptions
  Specified options
  @return The Base64-encoded object
  @see Base64#GZIP
  @see Base64#DO_BREAK_LINES
  @throws IOException
  if there is an error
  @since 2.0