java.lang.Object
com.pervasive.datarush.operators.io.GlobbingByteSource
- All Implemented Interfaces:
InputStreamSupplier,ByteSource
A data source representing the concatenation of
all files matching a pattern. Patterns are
specified using a file globbing pattern as
supported by
FileClient.matchPaths(String).
Directories which match the pattern are replaced
by all files contained within the directory.-
Constructor Summary
ConstructorsConstructorDescriptionGlobbingByteSource(String pattern) Defines a source consisting of all files matched by the specified pattern.GlobbingByteSource(String pattern, UnreadableSourceAction onUnreadable) Defines a source consisting of all files matched by the specified pattern. -
Method Summary
Modifier and TypeMethodDescriptionauthorize(FileClient client) Creates a new source with the same properties, but using the specified authorization.generateSplits(SplitOptions options) Gets an iterator producing a set ofDataSplitobjects covering the source.Gets the globbing pattern used to match files.Gets the configured behavior for handling unreadable source files.open()Opens the source for reading.toString()validate()Performs validation of the source configuration.
-
Constructor Details
-
GlobbingByteSource
Defines a source consisting of all files matched by the specified pattern. The source produces the bytes resulting from a concatenation of the matched files. The order of the files in result is undefined.If any selected file is unreadable, an error will be raised when the source is used.
- Parameters:
pattern- the file to use as a source
-
GlobbingByteSource
Defines a source consisting of all files matched by the specified pattern. The source produces the bytes resulting from a concatenation of the matched files. The order of the files in result is undefined.If any selected file is unreadable, it will be handled as specified.
- Parameters:
pattern- the file to use as a sourceonUnreadable- specifies the action to take for unreadable files
-
-
Method Details
-
getPattern
Gets the globbing pattern used to match files.- Returns:
- the file pattern for the source
-
getUnreadableAction
Gets the configured behavior for handling unreadable source files.- Returns:
- the configured behavior
-
authorize
Description copied from interface:ByteSourceCreates a new source with the same properties, but using the specified authorization.If a source is supposed to be used with a specific authorization context, this method should be called to produce a new source to use.
- Specified by:
authorizein interfaceByteSource- Parameters:
client- the authorization context to use for access- Returns:
- a source using the provided authorization context
-
open
Description copied from interface:ByteSourceOpens the source for reading. The caller is responsible for closing the returnedInputStream.- Specified by:
openin interfaceByteSource- Specified by:
openin interfaceInputStreamSupplier- Returns:
- a reader of the bytes from the source
- Throws:
IOException- if an I/O error occurs while opening the source
-
generateSplits
Description copied from interface:ByteSourceGets an iterator producing a set ofDataSplitobjects covering the source. The source is split as requested in the specified options, within the source's ability to meet the requirements.- Specified by:
generateSplitsin interfaceByteSource- Parameters:
options- configurable options to use in generating the splits- Returns:
- an iterator over valid splits of the source
- Throws:
IOException- if an I/O error occurs while generating splits
-
toString
-
validate
Description copied from interface:ByteSourcePerforms validation of the source configuration. This checks things such as the existence and accessibility of the source. It may also optionally rewrite the source to an equivalent one, doing file glob and directory expansion.- Specified by:
validatein interfaceByteSource- Returns:
- a valid source equivalent to this one
- Throws:
IOException- if an I/O error occurs while validating the source
-