public class TransformSplit extends BaseInputSplit
| Modifier and Type | Class and Description |
|---|---|
static interface |
TransformSplit.URITransform |
iterationOrder, length, uriStrings| Constructor and Description |
|---|
TransformSplit(@NonNull BaseInputSplit sourceSplit,
@NonNull TransformSplit.URITransform transform)
Apply a given transformation to the raw URI objects
|
| Modifier and Type | Method and Description |
|---|---|
void |
bootStrapForWrite()
Bootstrap this input split for writing.
|
boolean |
needsBootstrapForWrite()
Returns true if this
InputSplit
needs bootstrapping for writing. |
static TransformSplit |
ofSearchReplace(@NonNull BaseInputSplit sourceSplit,
@NonNull String search,
@NonNull String replace)
Static factory method, replace the string version of the URI with a simple search-replace pair
|
InputStream |
openInputStreamFor(String location)
Open an
InputStream
for the given location. |
OutputStream |
openOutputStreamFor(String location)
Open an
OutputStream
for the given location. |
void |
reset()
Reset the InputSplit without reinitializing it from scratch.
|
boolean |
resetSupported() |
void |
updateSplitLocations(boolean reset)
Refreshes the split locations
if needed in memory.
|
addNewLocation, addNewLocation, canWriteToLocation, length, locations, locationsIterator, locationsPathIterator, samplepublic TransformSplit(@NonNull
@NonNull BaseInputSplit sourceSplit,
@NonNull
@NonNull TransformSplit.URITransform transform)
throws URISyntaxException
sourceSplit - the split with URIs to transformtransform - transform operation that returns a new URI based on an input URIURISyntaxException - thrown if the transformed URI is malformedpublic static TransformSplit ofSearchReplace(@NonNull @NonNull BaseInputSplit sourceSplit, @NonNull @NonNull String search, @NonNull @NonNull String replace) throws URISyntaxException
sourceSplit - the split with URIs to transformsearch - the string to searchreplace - the string to replace withURISyntaxException - thrown if the transformed URI is malformedpublic void updateSplitLocations(boolean reset)
InputSplitpublic boolean needsBootstrapForWrite()
InputSplitInputSplit
needs bootstrapping for writing.
A simple example of needing bootstrapping is for
FileSplit where there is only a directory
existing, but no file to write topublic void bootStrapForWrite()
InputSplitRecordWriterpublic OutputStream openOutputStreamFor(String location) throws Exception
InputSplitOutputStream
for the given location.
Note that the user is responsible for closing
the associated output stream.location - the location to open the output stream forExceptionpublic InputStream openInputStreamFor(String location) throws Exception
InputSplitInputStream
for the given location.
Note that the user is responsible for closing
the associated input stream.location - the location to open the input stream forExceptionpublic void reset()
InputSplitpublic boolean resetSupported()
Copyright © 2020. All rights reserved.