Package org.apache.druid.data.input.impl
Class FileEntity
- java.lang.Object
-
- org.apache.druid.data.input.impl.FileEntity
-
- All Implemented Interfaces:
InputEntity
public class FileEntity extends Object implements InputEntity
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.druid.data.input.InputEntity
InputEntity.CleanableFile
-
-
Field Summary
-
Fields inherited from interface org.apache.druid.data.input.InputEntity
DEFAULT_FETCH_BUFFER_SIZE, DEFAULT_MAX_NUM_FETCH_TRIES, LOG
-
-
Constructor Summary
Constructors Constructor Description FileEntity(File file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputEntity.CleanableFilefetch(File temporaryDirectory, byte[] fetchBuffer)Fetches the input entity into the local storage.FilegetFile()URIgetUri()Returns an URI to identify the input entity.InputStreamopen()Opens anInputStreamon the input entity directly.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.druid.data.input.InputEntity
getRetryCondition
-
-
-
-
Constructor Detail
-
FileEntity
public FileEntity(File file)
-
-
Method Detail
-
fetch
public InputEntity.CleanableFile fetch(File temporaryDirectory, byte[] fetchBuffer)
Description copied from interface:InputEntityFetches the input entity into the local storage. This method might be preferred instead ofInputEntity.open(), for example -InputFormatrequires expensive random access on remote storage. - Holding a connection until you consume the entire InputStream is expensive.- Specified by:
fetchin interfaceInputEntity- Parameters:
temporaryDirectory- to store temp data. This directory will be removed automatically once the task finishes.fetchBuffer- is used to fetch remote entity into local storage.- See Also:
FileUtils.copyLarge(T, org.apache.druid.data.input.impl.prefetch.ObjectOpenFunction<T>, java.io.File, byte[], com.google.common.base.Predicate<java.lang.Throwable>, int, java.lang.String)
-
getUri
public URI getUri()
Description copied from interface:InputEntityReturns an URI to identify the input entity. Implementations can return null if they don't have an unique URI.- Specified by:
getUriin interfaceInputEntity
-
getFile
public File getFile()
-
open
public InputStream open() throws IOException
Description copied from interface:InputEntityOpens anInputStreamon the input entity directly. This is the basic way to read the given entity. This method may be called multiple times to re-read the data from the entity.- Specified by:
openin interfaceInputEntity- Throws:
IOException- See Also:
InputEntity.fetch(java.io.File, byte[])
-
-