Merge remote-tracking branch 'pr/19097' into release-2.3-dev

This commit is contained in:
Roland Kuhn 2015-12-18 11:51:17 +01:00
commit dcfa56e547
9 changed files with 146 additions and 167 deletions

View file

@ -195,13 +195,13 @@ object HttpEntity {
def apply(contentType: ContentType, data: Source[ByteString, Any]): HttpEntity.Chunked =
HttpEntity.Chunked.fromData(contentType, data)
/**
* Returns either the empty entity, if the given file is empty, or a [[Default]] entity
* consisting of a stream of [[ByteString]] instances each containing `chunkSize` bytes
* (except for the final ByteString, which simply contains the remaining bytes).
*
* If the given `chunkSize` is -1 the default chunk size is used.
*/
/**
* Returns either the empty entity, if the given file is empty, or a [[Default]] entity
* consisting of a stream of [[ByteString]] instances each containing `chunkSize` bytes
* (except for the final ByteString, which simply contains the remaining bytes).
*
* If the given `chunkSize` is -1 the default chunk size is used.
*/
def apply(contentType: ContentType, file: File, chunkSize: Int = -1): UniversalEntity = {
val fileLength = file.length
if (fileLength > 0)