Class SendfileDataBase

  • Direct Known Subclasses:
    Nio2Endpoint.SendfileData, NioEndpoint.SendfileData

    public abstract class SendfileDataBase
    extends java.lang.Object
    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

      Fields 
      Modifier and Type Field Description
      java.lang.String fileName
      The full path to the file that contains the data to be written to the socket.
      SendfileKeepAliveState keepAliveState
      Is the current request being processed on a keep-alive connection?
      long length
      The number of bytes remaining to be written from the file (from the current pos).
      long pos
      The position of the next byte in the file to be written to the socket.
    • Constructor Summary

      Constructors 
      Constructor Description
      SendfileDataBase​(java.lang.String filename, long pos, long length)
      Initialise the sendfile data with the given file path, starting position, and byte count.
    • Method Summary

      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • keepAliveState

        public SendfileKeepAliveState 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

        public final java.lang.String fileName
        The full path to the file that contains the data to be written to the socket.
      • pos

        public long pos
        The 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 length
        The number of bytes remaining to be written from the file (from the current pos). This is initialised to the end point - the start point and then updated as the file is written.
    • Constructor Detail

      • SendfileDataBase

        public SendfileDataBase​(java.lang.String filename,
                                long pos,
                                long length)
        Initialise the sendfile data with the given file path, starting position, and byte count.
        Parameters:
        filename - the path to the file to send
        pos - the starting position within the file
        length - the number of bytes to send