Class InputStreamSupplier

java.lang.Object
ch.ivyteam.ivy.jsf.primefaces.stream.InputStreamSupplier

public class InputStreamSupplier extends Object

To ease the migration of old Primefaces 7 DefaultStreamedContents, you can use this helper class in the builder as InputStream supplier

DefaultStreamedContent uses now a builder pattern instead of a constructor (with new). Therefore, when migrating to Axon Ivy 9.4 and later you have to change your file downloads from

new DefaultStreamedContent(new ByteArrayInputStream(result), "text/plain", in.downloadName);

to

DefaultStreamedContent.builder()
  .stream(InputStreamSupplier.stream(new ByteArrayInputStream(result)))
  .contentType("text/plain")
  .name(in.downloadName)
  .build();

Of course you can also use .stream(() -> new ByteArrayInputStream(result)) instead of this helper class, as long as your not in an IvyScript.

Since:
9.4
API:
This is a public API.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.primefaces.util.SerializableSupplier<InputStream>
    Get your InputStream as Supplier.
  • Method Details

    • stream

      public static org.primefaces.util.SerializableSupplier<InputStream> stream(InputStream is)
      Get your InputStream as Supplier.
      API:
      This public API is available in IvyScript and Java. It has the visibility ADVANCED.