Package org.datavec.api.split
Interface InputSplit
-
- All Known Implementing Classes:
BaseInputSplit,CollectionInputSplit,FileSplit,InputStreamInputSplit,ListStringSplit,NumberedFileInputSplit,OutputStreamInputSplit,StreamInputSplit,StringSplit,TransformSplit
public interface InputSplit
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringaddNewLocation()Add a new location with the name generated by this input split/StringaddNewLocation(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)voidbootStrapForWrite()Bootstrap this input split for writing.booleancanWriteToLocation(URI location)Returns true if the given uri can be written tolonglength()Length of the splitURI[]locations()Locations of the splitsIterator<URI>locationsIterator()Iterator<String>locationsPathIterator()booleanneedsBootstrapForWrite()Returns true if thisInputSplitneeds bootstrapping for writing.InputStreamopenInputStreamFor(String location)Open anInputStreamfor the given location.OutputStreamopenOutputStreamFor(String location)Open anOutputStreamfor the given location.voidreset()Reset the InputSplit without reinitializing it from scratch.booleanresetSupported()voidupdateSplitLocations(boolean reset)Refreshes the split locations if needed in memory.
-
-
-
Method Detail
-
canWriteToLocation
boolean canWriteToLocation(URI location)
Returns true if the given uri can be written to- Parameters:
location- the location to determine- Returns:
-
addNewLocation
String addNewLocation()
Add a new location with the name generated by this input split/
-
addNewLocation
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)- Parameters:
location- the location to add
-
updateSplitLocations
void updateSplitLocations(boolean reset)
Refreshes the split locations if needed in memory. (Think a few file gets added)- Parameters:
reset-
-
needsBootstrapForWrite
boolean needsBootstrapForWrite()
Returns true if thisInputSplitneeds bootstrapping for writing. A simple example of needing bootstrapping is forFileSplitwhere there is only a directory existing, but no file to write to- Returns:
- true if this input split needs bootstrapping for writing to or not
-
bootStrapForWrite
void bootStrapForWrite()
Bootstrap this input split for writing. This is for use withRecordWriter
-
openOutputStreamFor
OutputStream openOutputStreamFor(String location) throws Exception
Open anOutputStreamfor the given location. Note that the user is responsible for closing the associated output stream.- Parameters:
location- the location to open the output stream for- Returns:
- the output input stream
- Throws:
Exception
-
openInputStreamFor
InputStream openInputStreamFor(String location) throws Exception
Open anInputStreamfor the given location. Note that the user is responsible for closing the associated input stream.- Parameters:
location- the location to open the input stream for- Returns:
- the opened input stream
- Throws:
Exception
-
length
long length()
Length of the split- Returns:
-
locations
URI[] locations()
Locations of the splits- Returns:
-
reset
void reset()
Reset the InputSplit without reinitializing it from scratch. In many cases, this is a no-op. For InputSplits that have randomization: reset should shuffle the order.
-
resetSupported
boolean resetSupported()
- Returns:
- True if the reset() method is supported (or is a no-op), false otherwise. If false is returned, reset() may throw an exception
-
-