public class NumberedFileInputSplit extends Object implements InputSplit
Constructor and Description |
---|
NumberedFileInputSplit(String baseString,
int minIdxInclusive,
int maxIdxInclusive) |
Modifier and Type | Method and Description |
---|---|
String |
addNewLocation()
Add a new location with the name generated
by this input split/
|
String |
addNewLocation(String location)
Add a new location to this input split
(this may do anything from updating an in memory location
to creating a new file)
|
void |
bootStrapForWrite()
Bootstrap this input split for writing.
|
boolean |
canWriteToLocation(URI location)
Returns true if the given uri
can be written to
|
long |
length()
Length of the split
|
URI[] |
locations()
Locations of the splits
|
Iterator<URI> |
locationsIterator() |
Iterator<String> |
locationsPathIterator() |
boolean |
needsBootstrapForWrite()
Returns true if this
InputSplit
needs bootstrapping for writing. |
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.
|
public NumberedFileInputSplit(String baseString, int minIdxInclusive, int maxIdxInclusive)
baseString
- String that defines file format. Must contain "%d", which will be replaced with
the index of the file, possibly zero-padded to x digits if the pattern is in the form %0xd.minIdxInclusive
- Minimum index/number (starting number in sequence of files, inclusive)maxIdxInclusive
- Maximum index/number (last number in sequence of files, inclusive){NumberedFileInputSplitTest}
public boolean canWriteToLocation(URI location)
InputSplit
canWriteToLocation
in interface InputSplit
location
- the location to determinepublic String addNewLocation()
InputSplit
addNewLocation
in interface InputSplit
public String addNewLocation(String location)
InputSplit
addNewLocation
in interface InputSplit
location
- the location to addpublic void updateSplitLocations(boolean reset)
InputSplit
updateSplitLocations
in interface InputSplit
public boolean needsBootstrapForWrite()
InputSplit
InputSplit
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 toneedsBootstrapForWrite
in interface InputSplit
public void bootStrapForWrite()
InputSplit
RecordWriter
bootStrapForWrite
in interface InputSplit
public OutputStream openOutputStreamFor(String location) throws Exception
InputSplit
OutputStream
for the given location.
Note that the user is responsible for closing
the associated output stream.openOutputStreamFor
in interface InputSplit
location
- the location to open the output stream forException
public InputStream openInputStreamFor(String location) throws Exception
InputSplit
InputStream
for the given location.
Note that the user is responsible for closing
the associated input stream.openInputStreamFor
in interface InputSplit
location
- the location to open the input stream forException
public long length()
InputSplit
length
in interface InputSplit
public URI[] locations()
InputSplit
locations
in interface InputSplit
public Iterator<URI> locationsIterator()
locationsIterator
in interface InputSplit
public Iterator<String> locationsPathIterator()
locationsPathIterator
in interface InputSplit
public void reset()
InputSplit
reset
in interface InputSplit
public boolean resetSupported()
resetSupported
in interface InputSplit
Copyright © 2022. All rights reserved.