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)
InputSplitcanWriteToLocation in interface InputSplitlocation - the location to determinepublic String addNewLocation()
InputSplitaddNewLocation in interface InputSplitpublic String addNewLocation(String location)
InputSplitaddNewLocation in interface InputSplitlocation - the location to addpublic void updateSplitLocations(boolean reset)
InputSplitupdateSplitLocations in interface 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 toneedsBootstrapForWrite in interface InputSplitpublic void bootStrapForWrite()
InputSplitRecordWriterbootStrapForWrite in interface InputSplitpublic OutputStream openOutputStreamFor(String location) throws Exception
InputSplitOutputStream
for the given location.
Note that the user is responsible for closing
the associated output stream.openOutputStreamFor in interface InputSplitlocation - 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.openInputStreamFor in interface InputSplitlocation - the location to open the input stream forExceptionpublic long length()
InputSplitlength in interface InputSplitpublic URI[] locations()
InputSplitlocations in interface InputSplitpublic Iterator<URI> locationsIterator()
locationsIterator in interface InputSplitpublic Iterator<String> locationsPathIterator()
locationsPathIterator in interface InputSplitpublic void reset()
InputSplitreset in interface InputSplitpublic boolean resetSupported()
resetSupported in interface InputSplitpublic InputStream getIs()
public void setIs(InputStream is)
Copyright © 2020. All rights reserved.