Package com.linecorp.armeria.server.file
Interface AggregatedHttpFile
- All Superinterfaces:
HttpFile
public interface AggregatedHttpFile extends HttpFile
An immutable variant of
HttpFile
which has its attributes and content readily available.
Unlike HttpFile
, an AggregatedHttpFile
does not raise an IOException
for
readAttributes()
readHeaders()
HttpFile.read(Executor, ByteBufAllocator)
aggregate(Executor)
aggregateWithPooledObjects(Executor, ByteBufAllocator)
content()
which gives you an immediate access to the file's
content.-
Method Summary
Modifier and Type Method Description default CompletableFuture<AggregatedHttpFile>
aggregate(Executor fileReadExecutor)
Converts this file into anAggregatedHttpFile
.default CompletableFuture<AggregatedHttpFile>
aggregateWithPooledObjects(Executor fileReadExecutor, ByteBufAllocator alloc)
Converts this file into anAggregatedHttpFile
.HttpData
content()
Returns the content of the file.HttpFileAttributes
readAttributes()
Returns the attributes of the file.ResponseHeaders
readHeaders()
Returns the attributes of this file asResponseHeaders
, which could be useful for building a response for aHEAD
request.
-
Method Details
-
readAttributes
Returns the attributes of the file.- Specified by:
readAttributes
in interfaceHttpFile
- Returns:
- the attributes, or
null
if the file does not exist.
-
readHeaders
Returns the attributes of this file asResponseHeaders
, which could be useful for building a response for aHEAD
request.- Specified by:
readHeaders
in interfaceHttpFile
- Returns:
- the headers, or
null
if the file does not exist.
-
content
Returns the content of the file.- Returns:
- the content, or
null
if the file does not exist.
-
aggregate
Description copied from interface:HttpFile
Converts this file into anAggregatedHttpFile
.- Specified by:
aggregate
in interfaceHttpFile
- Parameters:
fileReadExecutor
- theExecutor
which will perform the read operations against the file- Returns:
- a
CompletableFuture
which will complete when the aggregation process is finished, or aCompletableFuture
successfully completed withthis
, if this file is already anAggregatedHttpFile
.
-
aggregateWithPooledObjects
default CompletableFuture<AggregatedHttpFile> aggregateWithPooledObjects(Executor fileReadExecutor, ByteBufAllocator alloc)Description copied from interface:HttpFile
Converts this file into anAggregatedHttpFile
.content()
will return a pooled object, and the caller must ensure to release it. If you don't know what this means, useHttpFile.aggregate(Executor)
.- Specified by:
aggregateWithPooledObjects
in interfaceHttpFile
- Parameters:
fileReadExecutor
- theExecutor
which will perform the read operations against the filealloc
- theByteBufAllocator
which will allocate the content buffer- Returns:
- a
CompletableFuture
which will complete when the aggregation process is finished, or aCompletableFuture
successfully completed withthis
, if this file is already anAggregatedHttpFile
.
-