Package org.apache.druid.data.input
Class RetryingInputEntity
- java.lang.Object
-
- org.apache.druid.data.input.RetryingInputEntity
-
- All Implemented Interfaces:
InputEntity
- Direct Known Subclasses:
HttpEntity
public abstract class RetryingInputEntity 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 RetryingInputEntity()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected int
getMaxRetries()
protected abstract String
getPath()
Get path name for this entity, used by the default implementation ofopen()
to determine if the underlying stream needs decompressed, based on file extension of the pathInputStream
open()
Open aRetryingInputStream
wrapper for an underlying input stream, optionally decompressing the retrying stream if the file extension matches a known compression, otherwise passing through the retrying stream directly.protected abstract InputStream
readFrom(long offset)
Directly opens anInputStream
starting at the given offset on the input entity.protected InputStream
readFromStart()
Directly opens anInputStream
on the input entity.-
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
fetch, getRetryCondition, getUri
-
-
-
-
Method Detail
-
open
public InputStream open() throws IOException
Open aRetryingInputStream
wrapper for an underlying input stream, optionally decompressing the retrying stream if the file extension matches a known compression, otherwise passing through the retrying stream directly.- Specified by:
open
in interfaceInputEntity
- Throws:
IOException
- See Also:
InputEntity.fetch(java.io.File, byte[])
-
getMaxRetries
protected int getMaxRetries()
-
readFromStart
protected InputStream readFromStart() throws IOException
Directly opens anInputStream
on the input entity. Decompression should be handled externally, and is handled by the default implementation ofopen()
, so this should return the raw stream for the object.- Throws:
IOException
-
readFrom
protected abstract InputStream readFrom(long offset) throws IOException
Directly opens anInputStream
starting at the given offset on the input entity. Decompression should be handled externally, and is handled by the default implementation ofopen()
,this should return the raw stream for the object.- Parameters:
offset
- an offset to start reading from. A non-negative integer counting the number of bytes from the beginning of the entity- Throws:
IOException
-
-