- java.lang.Object
-
- com.pervasive.datarush.io.InputStreamSuppliers
-
public final class InputStreamSuppliers extends Object
Contains various factory methods and utilities for creatingInputStreamSupplier
's.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.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.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.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.static InputStreamSupplier
path(FileClient client, Path path)
Returns an InputStreamSupplier that will open the specified path.static InputStreamSupplier
path(FileClient client, Path path, boolean ignoreNonExistent)
Returns an InputStreamSupplier that will open the specified path.
-
-
-
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 pathspaths
- 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 pathspaths
- the paths to openignoreNonExistent
- 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 pathpath
- 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 pathpath
- the path to openignoreNonExistent
- 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 sameFileSystem
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 filespaths
- the list of pathsignoreNonExistant
- 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
-
-