public class LocalFileContent
extends ReadChannelContent
OutgoingContent representing a local file with a specified contentType, ApplicationResponsePropertiesJvmKt.expires
date and CachingOptionsKt.getCaching
OutgoingContent.ByteArrayContent, OutgoingContent.NoContent, OutgoingContent.ProtocolUpgrade, OutgoingContent.ReadChannelContent, OutgoingContent.WriteChannelContent
Constructor and Description |
---|
LocalFileContent(java.io.File file,
ContentType contentType)
OutgoingContent representing a local file with a specified contentType,
ApplicationResponsePropertiesJvmKt.expires date and CachingOptionsKt.getCaching |
Modifier and Type | Method and Description |
---|---|
java.lang.Long |
getContentLength()
Specifies content length in bytes for this resource.
|
ContentType |
getContentType()
Specifies
|
java.io.File |
getFile()
specifies the File to be served to a client
|
kotlinx.coroutines.io.ByteReadChannel |
readFrom()
Provides ByteReadChannel for the content
|
kotlinx.coroutines.io.ByteReadChannel |
readFrom(kotlin.ranges.LongRange range)
Provides ByteReadChannel for the given range of the content
|
readFrom, readFrom
getContentLength, getContentType, getHeaders, getProperty, getStatus, setProperty
public LocalFileContent(java.io.File file, ContentType contentType)
OutgoingContent representing a local file with a specified contentType, ApplicationResponsePropertiesJvmKt.expires
date and CachingOptionsKt.getCaching
file
- specifies the File to be served to a clientcontentType
- Specifies class ContentType
for this resource.file
- specifies the File to be served to a clientApplicationResponsePropertiesJvmKt.expires
,
CachingOptionsKt.getCaching
public java.lang.Long getContentLength()
Specifies content length in bytes for this resource.
If null, the resources will be sent as Transfer-Encoding: chunked
public kotlinx.coroutines.io.ByteReadChannel readFrom()
Provides ByteReadChannel for the content
public kotlinx.coroutines.io.ByteReadChannel readFrom(kotlin.ranges.LongRange range)
Provides ByteReadChannel for the given range of the content
public java.io.File getFile()
specifies the File to be served to a client
public ContentType getContentType()
Specifies
class ContentType
for this resource.
class ContentType