Class InputStreamSuppliers


  • public final class InputStreamSuppliers
    extends Object
    Contains various factory methods and utilities for creating InputStreamSupplier's.
    • Method Detail

      • concat

        public static InputStreamSupplier concat​(FileClient client,
                                                 List<Path> paths)
        Creates an InputStreamSupplier that will return an input stream consisting of the streams of each of the paths, concatenated together. The streams will be returned in the same order as the specified paths. If any paths do not exist, an exception will be raised upon opening the supplier.
        Parameters:
        client - the file client that will be used to open the paths
        paths - the paths to open
        Returns:
        a concatenated InputStreamSupplier
      • concat

        public static InputStreamSupplier concat​(FileClient client,
                                                 List<Path> paths,
                                                 boolean ignoreNonExistent)
        Creates an InputStreamSupplier that will return an input stream consisting of the streams of each of the paths, concatenated together. The streams will be returned in the same order as the specified paths.
        Parameters:
        client - the file client that will be used to open the paths
        paths - the paths to open
        ignoreNonExistent - if true, a non-existent file will be treated as an empty file. if false, a non-existent file will result in an exception.
        ctx - if non-null, provides a monitoring context
        Returns:
        a concatenated InputStreamSupplier
      • concat

        public static InputStreamSupplier concat​(List<? extends InputStreamSupplier> sources)
        Creates an InputStreamSupplier that will return an input stream consisting of the streams of each of the sources, concatenated together. The streams will be returned in the same order as the specified sources.
        Parameters:
        sources - the sources to concatenate
        Returns:
        a concatenated InputStreamSupplier
      • path

        public static InputStreamSupplier path​(FileClient client,
                                               Path path)
        Returns an InputStreamSupplier that will open the specified path. If the path does not exist, an exception will be raised upon opening the supplier.
        Parameters:
        client - the file client that will be used to open the path
        path - the path to open
        Returns:
        an InputStreamSupplier for the specified path.
      • path

        public static InputStreamSupplier path​(FileClient client,
                                               Path path,
                                               boolean ignoreNonExistent)
        Returns an InputStreamSupplier that will open the specified path.
        Parameters:
        client - the file client that will be used to open the path
        path - the path to open
        ignoreNonExistent - if true, a non-existent file will be treated as an empty file. if false, a non-existent file will result in an exception.
        ctx - if non-null, provides a monitoring context
        Returns:
        an InputStreamSupplier for the specified path.
      • combine

        public static InputStreamSupplier combine​(FileClient client,
                                                  List<Path> paths,
                                                  boolean ignoreNonExistant)
        Creates an InputStreamSupplier that will return an input stream consisting of the streams of each of the sources, combined together. Paths from the same FileSystem will be fetched in-bulk if the filesystem supports concatenation.

        NOTE: Unlike concat(com.pervasive.datarush.io.FileClient, java.util.List<com.pervasive.datarush.io.Path>), this method does not make any guarantees as to the order in which the sources are combined.

        Parameters:
        client - the fileclient to use to open the files
        paths - the list of paths
        ignoreNonExistant - if true, a non-existent file will be treated as an empty file. if false, a non-existent file will result in an exception.
        Returns:
        a combined InputStreamSupplier