Package org.datavec.api.split
Class OutputStreamInputSplit
- java.lang.Object
-
- org.datavec.api.split.OutputStreamInputSplit
-
- All Implemented Interfaces:
InputSplit
public class OutputStreamInputSplit extends Object implements InputSplit
-
-
Constructor Summary
Constructors Constructor Description OutputStreamInputSplit(OutputStream outputStream)
-
Method Summary
All Methods Instance Methods Concrete 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.
-
-
-
Constructor Detail
-
OutputStreamInputSplit
public OutputStreamInputSplit(OutputStream outputStream)
-
-
Method Detail
-
canWriteToLocation
public boolean canWriteToLocation(URI location)
Description copied from interface:InputSplitReturns true if the given uri can be written to- Specified by:
canWriteToLocationin interfaceInputSplit- Parameters:
location- the location to determine- Returns:
-
addNewLocation
public String addNewLocation()
Description copied from interface:InputSplitAdd a new location with the name generated by this input split/- Specified by:
addNewLocationin interfaceInputSplit
-
addNewLocation
public String addNewLocation(String location)
Description copied from interface:InputSplitAdd a new location to this input split (this may do anything from updating an in memory location to creating a new file)- Specified by:
addNewLocationin interfaceInputSplit- Parameters:
location- the location to add
-
updateSplitLocations
public void updateSplitLocations(boolean reset)
Description copied from interface:InputSplitRefreshes the split locations if needed in memory. (Think a few file gets added)- Specified by:
updateSplitLocationsin interfaceInputSplit
-
needsBootstrapForWrite
public boolean needsBootstrapForWrite()
Description copied from interface:InputSplitReturns 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- Specified by:
needsBootstrapForWritein interfaceInputSplit- Returns:
- true if this input split needs bootstrapping for writing to or not
-
bootStrapForWrite
public void bootStrapForWrite()
Description copied from interface:InputSplitBootstrap this input split for writing. This is for use withRecordWriter- Specified by:
bootStrapForWritein interfaceInputSplit
-
openOutputStreamFor
public OutputStream openOutputStreamFor(String location) throws Exception
Description copied from interface:InputSplitOpen anOutputStreamfor the given location. Note that the user is responsible for closing the associated output stream.- Specified by:
openOutputStreamForin interfaceInputSplit- Parameters:
location- the location to open the output stream for- Returns:
- the output input stream
- Throws:
Exception
-
openInputStreamFor
public InputStream openInputStreamFor(String location) throws Exception
Description copied from interface:InputSplitOpen anInputStreamfor the given location. Note that the user is responsible for closing the associated input stream.- Specified by:
openInputStreamForin interfaceInputSplit- Parameters:
location- the location to open the input stream for- Returns:
- the opened input stream
- Throws:
Exception
-
length
public long length()
Description copied from interface:InputSplitLength of the split- Specified by:
lengthin interfaceInputSplit- Returns:
-
locations
public URI[] locations()
Description copied from interface:InputSplitLocations of the splits- Specified by:
locationsin interfaceInputSplit- Returns:
-
locationsIterator
public Iterator<URI> locationsIterator()
- Specified by:
locationsIteratorin interfaceInputSplit- Returns:
-
locationsPathIterator
public Iterator<String> locationsPathIterator()
- Specified by:
locationsPathIteratorin interfaceInputSplit- Returns:
-
reset
public void reset()
Description copied from interface:InputSplitReset 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.- Specified by:
resetin interfaceInputSplit
-
resetSupported
public boolean resetSupported()
- Specified by:
resetSupportedin interfaceInputSplit- Returns:
- True if the reset() method is supported (or is a no-op), false otherwise. If false is returned, reset() may throw an exception
-
-