Class DefaultNetPackage


  • public class DefaultNetPackage
    extends NetPackage
    Default implementation of the net package.
    Author:
    javaito
    • Constructor Detail

      • DefaultNetPackage

        public DefaultNetPackage​(java.lang.String remoteHost,
                                 java.lang.String remoteAddress,
                                 int remotePort,
                                 int localPort,
                                 byte[] payload,
                                 NetPackage.ActionEvent actionEvent)
    • Method Detail

      • getSession

        public NetSession getSession()
        Return the net session of the package.
        Specified by:
        getSession in class NetPackage
        Returns:
        Net session.
      • setSession

        public void setSession​(NetSession session)
        Set the session over the package was created.
        Specified by:
        setSession in class NetPackage
        Parameters:
        session - Net session
      • getPayload

        public byte[] getPayload()
        Return the payload of the package.
        Specified by:
        getPayload in class NetPackage
        Returns:
        Payload of the package.
      • getRemoteAddress

        public java.lang.String getRemoteAddress()
        Return the remote ip address.
        Specified by:
        getRemoteAddress in class NetPackage
        Returns:
        Remote ip address.
      • getRemoteHost

        public java.lang.String getRemoteHost()
        Return the address of the remote host.
        Specified by:
        getRemoteHost in class NetPackage
        Returns:
        Address of the remote host.
      • getRemotePort

        public int getRemotePort()
        Return the port of the remote host.
        Specified by:
        getRemotePort in class NetPackage
        Returns:
        Port of the remote host.
      • getLocalPort

        public int getLocalPort()
        Return the local port on the connections was stablished
        Specified by:
        getLocalPort in class NetPackage
        Returns:
        Local port.
      • getDate

        public java.util.Date getDate()
        Return the creation date of the package.
        Specified by:
        getDate in class NetPackage
        Returns:
        Creation date of the package.