public class BasicByteSource extends Object implements ByteSource
Path
.
Typically, these represent readable files.Constructor and Description |
---|
BasicByteSource(Path path)
Creates a data source for the named path.
|
BasicByteSource(Path path,
CompressionFormat format)
Creates a data source for the named path.
|
BasicByteSource(Path path,
UnreadableSourceAction onUnreadable)
Creates a data source for the named path.
|
BasicByteSource(String path)
Creates a data source for the named path.
|
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. |
CompressionFormat |
getCompression()
Gets the compression format expected for reading.
|
Path |
getPath()
Gets the path identifying the byte source.
|
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 BasicByteSource(String path)
The last element of the path is used
to automatically determine if the source
is compressed, and if so, what the format
is. If this is not desired, use
BasicByteSource(Path, CompressionFormat)
instead.
path
- the file to use as a sourcepublic BasicByteSource(Path path)
The last element of the path is used
to automatically determine if the source
is compressed, and if so, what the format
is. If this is not desired, use
BasicByteSource(Path, CompressionFormat)
instead.
path
- the file to use as a sourcepublic BasicByteSource(Path path, UnreadableSourceAction onUnreadable)
The last element of the path is used
to automatically determine if the source
is compressed, and if so, what the format
is. If this is not desired, use
BasicByteSource(Path, CompressionFormat)
instead.
path
- the file to use as a sourceonUnreadable
- specifies the action to take for unreadable
filespublic BasicByteSource(Path path, CompressionFormat format)
If the path identifies a directory, it is interpreted to mean all files in the directory. If any selected file is unreadable, an error will be raised when the source is used.
path
- the file/directory to readformat
- the compression format of the
identified file(s)public Path getPath()
public CompressionFormat getCompression()
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.