public class InputStreamInputSplit extends Object implements InputSplit
Constructor and Description |
---|
InputStreamInputSplit(InputStream is) |
InputStreamInputSplit(InputStream is,
File path)
Instantiate with the given
file as a uri
|
InputStreamInputSplit(InputStream is,
String path)
Instantiate with the given
file as a uri
|
InputStreamInputSplit(InputStream is,
URI path)
Instantiate with the given
file as a uri
|
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
|
InputStream |
getIs() |
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 |
setIs(InputStream is) |
void |
updateSplitLocations(boolean reset)
Refreshes the split locations
if needed in memory.
|
public InputStreamInputSplit(InputStream is, String path)
is
- the input stream to usepath
- the path to usepublic InputStreamInputSplit(InputStream is, File path)
is
- the input stream to usepath
- the path to usepublic InputStreamInputSplit(InputStream is, URI path)
is
- the input stream to usepath
- the path to usepublic InputStreamInputSplit(InputStream is)
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
public InputStream getIs()
public void setIs(InputStream is)
Copyright © 2022. All rights reserved.