de.hfu.anybeam.networkCore

## Class Client

- java.lang.Object
- - de.hfu.anybeam.networkCore.Client

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Client>

      public class Client
      extends java.lang.Object
      implements java.lang.Comparable<Client>, java.io.Serializable

  Represents a network Client with all necessary Information.
  Since:
    1.0
  Version:
    1.0
  Author:
    chrwuer
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Client(java.net.InetAddress address, java.lang.String name, int dataPort, java.lang.String id, java.lang.String osName, DeviceType deviceType)` Creates a new `Client` instance with the given Information.
    `Client(java.net.InetAddress address, java.lang.String name, int dataPort, java.lang.String id, java.lang.String osName, java.lang.String deviceType)` Creates a new `Client` instance with the given Information.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(Client o)`
    `void` | `copy(Client source)` Copies all values from the given source `Client`.
    `boolean` | `equals(java.lang.Object obj)`
    `java.net.InetAddress` | `getAddress()` Returns the client's `InetAddress`.
    `int` | `getDataPort()` Returns the port on which the client is listening for incoming data transmissions.
    `DeviceType` | `getDeviceType()` Returns the client's `DeviceType`.
    `java.lang.String` | `getId()` Returns the client's id.
    `java.lang.String` | `getName()` Returns the client's name.
    `java.lang.String` | `getOsName()` Returns the name of the client's os.
    `void` | `sendData(java.io.InputStream inputStream, int inputStreamLength, NetworkEnvironmentSettings settings)` Sends the data from the stream to the client.
    `void` | `sendData(java.io.InputStream inputStream, int inputStreamLength, java.lang.String sourceName, NetworkEnvironmentSettings settings)` Sends the data from the stream to the client.
    `void` | `sendData(java.io.InputStream inputStream, long inputStreamLength, java.lang.String sourceName, EncryptionType encryptionType, byte[] encryptionKey)` Sends the data from the stream to the client.
    `void` | `sendData(java.io.InputStream inputStream, long inputStreamLength, java.lang.String sourceName, NetworkEnvironmentSettings settings)` Sends the data from the stream to the client.
    `void` | `sendData(java.io.InputStream inputStream, NetworkEnvironmentSettings settings)` Sends the data from the stream to the client.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Client

          public Client(java.net.InetAddress address,
                java.lang.String name,
                int dataPort,
                java.lang.String id,
                java.lang.String osName,
                java.lang.String deviceType)

      Creates a new `Client` instance with the given Information.
      Parameters:
        `address` - the client's `InetAddress`
        `name` - the client's name
        `dataPort` - the port on which the client is listening for incoming data tranmissions
        `id` - the client's id (from `NetworkEnvironmentSettings`
        `osName` - the name of the client's operating system
        `deviceType` - a String representing the client's `DeviceType`

    - #### Client

          public Client(java.net.InetAddress address,
                java.lang.String name,
                int dataPort,
                java.lang.String id,
                java.lang.String osName,
                DeviceType deviceType)

      Creates a new `Client` instance with the given Information.
      Parameters:
        `address` - the client's `InetAddress`
        `name` - the client's name
        `dataPort` - the port on which the client is listening for incoming data tranmissions
        `id` - the client's id (from `NetworkEnvironmentSettings`
        `osName` - the name of the client's operating system
        `deviceType` - the client's `DeviceType`

  - ### Method Detail

    - #### getAddress

          public java.net.InetAddress getAddress()

      Returns the client's `InetAddress`.
      Returns:
        The client's `InetAddress`

    - #### getName

          public java.lang.String getName()

      Returns the client's name.
      Returns:
        The client's name.

    - #### getDataPort

          public int getDataPort()

      Returns the port on which the client is listening for incoming data transmissions.
      Returns:
        the port on which the client is listening for incoming data transmissions

    - #### getId

          public java.lang.String getId()

      Returns the client's id.
      Returns:
        the client's id

    - #### getOsName

          public java.lang.String getOsName()

      Returns the name of the client's os.
      Returns:
        the name of the client's os

    - #### getDeviceType

          public DeviceType getDeviceType()

      Returns the client's `DeviceType`.
      Returns:
        the client's `DeviceType`.

    - #### sendData

          public void sendData(java.io.InputStream inputStream,
                      NetworkEnvironmentSettings settings)
                        throws java.lang.Exception

      Sends the data from the stream to the client.
      Parameters:
        `inputStream` - the `InputStream` to send the data from
        `settings` - the `NetworkEnvironmentSettings` to get all necessary information from
      Throws:
        `java.lang.Exception`

    - #### sendData

          public void sendData(java.io.InputStream inputStream,
                      int inputStreamLength,
                      NetworkEnvironmentSettings settings)
                        throws java.lang.Exception

      Sends the data from the stream to the client.
      Parameters:
        `inputStream` - the `InputStream` to send the data from
        `inputStreamLength` - the length of inputStream or -1 if inputStream is endless
        `settings` - the `NetworkEnvironmentSettings` to get all necessary information from
      Throws:
        `java.lang.Exception`

    - #### sendData

          public void sendData(java.io.InputStream inputStream,
                      int inputStreamLength,
                      java.lang.String sourceName,
                      NetworkEnvironmentSettings settings)
                        throws java.lang.Exception

      Sends the data from the stream to the client.
      Parameters:
        `inputStream` - the `InputStream` to send the data from
        `inputStreamLength` - the length of inputStream or -1 if inputStream is endless
        `sourceName` - the name of the source represented by inputStream e.g. the filename
        `settings` - the `NetworkEnvironmentSettings` to get all necessary information from
      Throws:
        `java.lang.Exception`

    - #### sendData

          public void sendData(java.io.InputStream inputStream,
                      long inputStreamLength,
                      java.lang.String sourceName,
                      NetworkEnvironmentSettings settings)
                        throws java.lang.Exception

      Sends the data from the stream to the client.
      Parameters:
        `inputStream` - the `InputStream` to send the data from
        `inputStreamLength` - the length of inputStream or -1 if inputStream is endless
        `sourceName` - the name of the source represented by inputStream e.g. the filename
        `settings` - the `NetworkEnvironmentSettings` to get all necessary information from
      Throws:
        `java.lang.Exception`

    - #### sendData

          public void sendData(java.io.InputStream inputStream,
                      long inputStreamLength,
                      java.lang.String sourceName,
                      EncryptionType encryptionType,
                      byte[] encryptionKey)
                        throws java.lang.Exception

      Sends the data from the stream to the client.
      Parameters:
        `inputStream` - the `InputStream` to send the data from
        `inputStreamLength` - the length of inputStream or -1 if inputStream is endless
        `sourceName` - the name of the source represented by inputStream e.g. the filename
        `encryptionType` - the `EncryptionType` to be used
        `encryptionKey` - the key to encrypt the data or null if no encryption is used
      Throws:
        `java.lang.Exception`

    - #### copy

          public void copy(Client source)

      Copies all values from the given source `Client`.
      Parameters:
        `source` - the `Client` to copy all values from.

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### compareTo

          public int compareTo(Client o)

      Specified by:
        `compareTo` in interface `java.lang.Comparable<Client>`