Class ReadSocket


  • public class ReadSocket
    extends AbstractSocket
    Action performed when reading on a socket.
    • Constructor Detail

      • ReadSocket

        public ReadSocket​(Socket socket,
                          int nbBytes)
        Creates a read socket action.
        Parameters:
        socket - the socket of the read action.
        nbBytes - the number of read bytes.
    • Method Detail

      • getNbBytes

        public int getNbBytes()
        Gets the number of bytes to be read.
        Returns:
        the number of bytes to be read.
      • onStart

        public int onStart()
                    throws SecurityException
        Called when the execution of the action is about to start. This hook is used to check if the action is allowed to be performed.
        Returns:
        the number of bytes read.
        Throws:
        SecurityException - if the action is not allowed to be performed.
      • onEnd

        public void onEnd​(int nbBytesRead)
        Called when the execution of the action is finished. This hook is used to update the current resources state of the module that performs the action.
        Parameters:
        nbBytesRead - the actual number of bytes read.