public class GlobbingByteSource extends Object implements ByteSource
FileClient.matchPaths(String)
.
Directories which match the pattern are replaced
by all files contained within the directory.Constructor and Description |
---|
GlobbingByteSource(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.
|
Modifier and Type | Method and Description |
---|---|
ByteSource |
authorize(FileClient client)
Creates a new source with the same properties, but using the
specified authorization.
|
SplitIterator |
generateSplits(SplitOptions options)
Gets an iterator producing a set of
DataSplit objects
covering the source. |
String |
getPattern()
Gets the globbing pattern used to match files.
|
UnreadableSourceAction |
getUnreadableAction()
Gets the configured behavior for handling unreadable
source files.
|
InputStream |
open()
Opens the source for reading.
|
String |
toString() |
ByteSource |
validate()
Performs validation of the source configuration.
|
public GlobbingByteSource(String pattern)
If any selected file is unreadable, an error will be raised when the source is used.
pattern
- the file to use as a sourcepublic GlobbingByteSource(String pattern, UnreadableSourceAction onUnreadable)
If any selected file is unreadable, it will be handled as specified.
pattern
- the file to use as a sourceonUnreadable
- specifies the action to take for unreadable
filespublic String getPattern()
public UnreadableSourceAction getUnreadableAction()
public ByteSource authorize(FileClient client)
ByteSource
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.
authorize
in interface ByteSource
client
- the authorization context to use for accesspublic InputStream open() throws IOException
ByteSource
InputStream
.open
in interface InputStreamSupplier
open
in interface ByteSource
IOException
- if an I/O error occurs while opening the sourcepublic SplitIterator generateSplits(SplitOptions options) throws IOException
ByteSource
DataSplit
objects
covering the source. The source is split as requested
in the specified options, within the source's ability to
meet the requirements.generateSplits
in interface ByteSource
options
- configurable options to use in generating
the splitsIOException
- if an I/O error occurs while generating splitspublic ByteSource validate() throws IOException
ByteSource
validate
in interface ByteSource
IOException
- if an I/O error occurs while
validating the sourceCopyright © 2024 Actian Corporation. All rights reserved.