Class SendfileDataBase
java.lang.Object
org.apache.tomcat.util.net.SendfileDataBase
- Direct Known Subclasses:
Nio2Endpoint.SendfileData, NioEndpoint.SendfileData
Base class for sendfile operations. Tracks the file path, position, length,
and keep-alive state for zero-copy file transfer to a socket.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal StringThe full path to the file that contains the data to be written to the socket.Is the current request being processed on a keep-alive connection?longThe number of bytes remaining to be written from the file (from the currentpos).longThe position of the next byte in the file to be written to the socket. -
Constructor Summary
ConstructorsConstructorDescriptionSendfileDataBase(String filename, long pos, long length) Initialise the sendfile data with the given file path, starting position, and byte count. -
Method Summary
-
Field Details
-
keepAliveState
Is the current request being processed on a keep-alive connection? This determines if the socket is closed once the send file completes or if processing continues with the next request on the connection or waiting for that next request to arrive. -
fileName
The full path to the file that contains the data to be written to the socket. -
pos
public long posThe position of the next byte in the file to be written to the socket. This is initialised to the start point and then updated as the file is written. -
length
public long lengthThe number of bytes remaining to be written from the file (from the currentpos). This is initialised to the end point - the start point and then updated as the file is written.
-
-
Constructor Details
-
SendfileDataBase
Initialise the sendfile data with the given file path, starting position, and byte count.- Parameters:
filename- the path to the file to sendpos- the starting position within the filelength- the number of bytes to send
-