java.lang.Object
org.klomp.snark.web.BasicServlet.FileContent
org.klomp.snark.web.BasicServlet.LimitFileContent
- All Implemented Interfaces:
BasicServlet.HttpContent
- Enclosing class:
BasicServlet
File content with byte limit.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final longMost bytes to read, negative for all of them.Constructor Summary
ConstructorsConstructorDescriptionLimitFileContent(File file, long limit) Create a content provider for the file, limited to the given byte count.Method Summary
All MethodsMethods inherited from class BasicServlet.FileContent
getCacheTime, getContentType, getInputStream, getLastModified, toStringModifier and TypeMethodDescriptionintThe cache time.The content type.The input stream.longThe last modified time.toString()String form of the content.
Field Details
_limit
private final long _limitMost bytes to read, negative for all of them.
Constructor Details
LimitFileContent
Create a content provider for the file, limited to the given byte count.- Parameters:
file- the file to serve, read only from its startlimit- max bytes to serve
Method Details
getContentLength
public long getContentLength()The content length.- Specified by:
getContentLengthin interfaceBasicServlet.HttpContent- Overrides:
getContentLengthin classBasicServlet.FileContent- Returns:
- the byte length for the Content-Length header