Package org.apache.druid.data.input.impl
Class ByteEntity
- java.lang.Object
-
- org.apache.druid.data.input.impl.ByteEntity
-
- All Implemented Interfaces:
InputEntity
public class ByteEntity 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 ByteEntity(byte[] bytes)ByteEntity(ByteBuffer buffer)Create a new entity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteBuffergetBuffer()Return the buffer backing this entity.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
fetch, getRetryCondition
-
-
-
-
Constructor Detail
-
ByteEntity
public ByteEntity(ByteBuffer buffer)
Create a new entity. The buffer is not duplicated, so it is important to ensure that its position and limit are not modified after this entity is created.
-
ByteEntity
public ByteEntity(byte[] bytes)
-
-
Method Detail
-
getBuffer
public ByteBuffer getBuffer()
Return the buffer backing this entity. Calling code must not modify the mark, position, or limit of this buffer. If you need to modify them, callByteBuffer.duplicate()orByteBuffer.asReadOnlyBuffer()and modify the copy.
-
getUri
@Nullable 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
-
open
public InputStream open()
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- See Also:
InputEntity.fetch(java.io.File, byte[])
-
-