slices/view/src/main/java/androidx/slice/SliceUtils.java
public static void serializeSlice(@NonNull Slice s, @NonNull Context context,
            @NonNull OutputStream output, @NonNull String encoding,
            @NonNull SerializeOptions options) throws IOException, IllegalArgumentException {
        SliceXml.serializeSlice(s, context, output, encoding, options);
    }
/**
     * Serialize a slice to an OutputStream.
     * <p>
     * The slice can later be read into slice form again with {@link #parseSlice}.
     * Some slice types cannot be serialized, their handling is controlled by
     * {@link SerializeOptions}.
     *
     * @param s The slice to serialize.
     * @param context Context used to load any resources in the slice.
     * @param output The output of the serialization.
     * @param encoding The encoding to use for serialization.
     * @param options Options defining how to handle non-serializable items.
     * @throws IllegalArgumentException if the slice cannot be serialized using the given options.
     */
Serialize a slice to an OutputStream.

The slice can later be read into slice form again with  #parseSlice.
Some slice types cannot be serialized, their handling is controlled by
SerializeOptions.

@param s The slice to serialize.
@param context Context used to load any resources in the slice.
@param output The output of the serialization.
@param encoding The encoding to use for serialization.
@param options Options defining how to handle non-serializable items.
@throws IllegalArgumentException if the slice cannot be serialized using the given options.
Serialize a slice to an OutputStream . The slice can later be read into slice form again with #parseSlice . Some slice types cannot be serialized their handling is controlled by SerializeOptions . @param s The slice to serialize . @param context Context used to load any resources in the slice . @param output The output of the serialization . @param encoding The encoding to use for serialization . @param options Options defining how to handle non - serializable items . @throws IllegalArgumentException if the slice cannot be serialized using the given options .
public static void serializeSlice(@NonNull Slice s, @NonNull Context context,
            @NonNull OutputStream output, @NonNull String encoding,
            @NonNull SerializeOptions options) throws IOException, IllegalArgumentException {
        SliceXml.serializeSlice(s, context, output, encoding, options);
    }
public static void serializeSlice ( @ NonNull Slice s , @ NonNull Context context , @ NonNull OutputStream output , @ NonNull String encoding , @ NonNull SerializeOptions options ) throws IOException , IllegalArgumentException { SliceXml . serializeSlice ( s , context , output , encoding , options ) ; }
Serialize a slice to an OutputStream.
Serialize a slice to an OutputStream .