java - Why does netty example for HttpStaticFileServer use RandomAccessFile? -


is there specific reason netty httpstaticfileserverhandler example use randomaccessfile?

i think can demonstrate use of chunkedfile, requires randomaccessfile. , reason seems chunkedfile needs able file's length.


if not using https, need not use chunkedfile. can choose fileinputstream instead of randomaccessfile returns filechannel. cannot filelength fileinputstream required input defaultfileregion. think necessary use randomaccessfile.

that's correct. however, potentially file length other way; e.g. using file.length().

actually, doesn't make difference way filechannel , file length.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -