org.licas.server.model

## Class PacketInfo

- java.lang.Object
- - org.licas.server.model.PacketInfo

-     public class PacketInfo
      extends java.lang.Object

  This class stores information relating to transferring a message in parts from one server to another. A message can be converted into a String-based description and then sent in a single transaction call from one server to another. If the message is very large, then you can decide to send it in parts. The approximate maximum size of a message part can be specified and the message will be split up into strings of this size. Each string can then be sent in separate calls and saved to a file on the receiving server. When all parts have been sent the file can be read and the message converted back into the Java objects.
  Author:
    Kieran Greer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PacketInfo(java.lang.String thisFileName, int thisPacketSize)` Create a new instance of PacketInfo

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `closeFileChannel()` Close the file input channel.
    `boolean` | `closeFileWriter()` Close the file writer.
    `boolean` | `createFile()` Create a file with the name of fileName.
    `void` | `deleteFile()` Delete the currently stored file.
    `java.lang.String` | `getFileName()` Get the file name.
    `java.io.FileWriter` | `getFileWriter()` Get the file writer.
    `java.io.DataInputStream` | `getInputStream()` Get the file connection for the current file.
    `java.io.DataOutputStream` | `getOutputStream()` Get the file connection for the current file.
    `int` | `getPacketSize()` Get the packet size.
    `void` | `setFileName(java.lang.String theFileName)` Set the file name.
    `void` | `setPacketSize(int thePacketSize)` Set the packet size to the value passed in.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PacketInfo

          public PacketInfo(java.lang.String thisFileName,
                            int thisPacketSize)

      Create a new instance of PacketInfo
      Parameters:
        `thisFileName` - the name of the file to write to.
        `thisPacketSize` - the maximum size of the message packet to send.

  - ### Method Detail

    - #### setPacketSize

          public void setPacketSize(int thePacketSize)

      Set the packet size to the value passed in.
      Parameters:
        `thePacketSize` - the packet size.

    - #### getPacketSize

          public int getPacketSize()

      Get the packet size.
      Returns:
        the value of packetSize.

    - #### setFileName

          public void setFileName(java.lang.String theFileName)

      Set the file name.
      Parameters:
        `theFileName` - the file name.

    - #### getFileName

          public java.lang.String getFileName()

      Get the file name.
      Returns:
        the value of fileName.

    - #### getFileWriter

          public java.io.FileWriter getFileWriter()

      Get the file writer.
      Returns:
        the value of fileWriter.

    - #### createFile

          public boolean createFile()

      Create a file with the name of fileName.
      Returns:
        true if the file can be created or false otherwise.

    - #### closeFileWriter

          public boolean closeFileWriter()

      Close the file writer.
      Returns:
        true if closed successfully.

    - #### deleteFile

          public void deleteFile()

      Delete the currently stored file.

    - #### getInputStream

          public java.io.DataInputStream getInputStream()
                                                 throws java.lang.Exception

      Get the file connection for the current file.
      Returns:
        the input stream generated from the fileConnection.
      Throws:
        `java.lang.Exception` - any error.

    - #### getOutputStream

          public java.io.DataOutputStream getOutputStream()

      Get the file connection for the current file.
      Returns:
        the output stream generated from the fileConnection.

    - #### closeFileChannel

          public boolean closeFileChannel()

      Close the file input channel.
      Returns:
        true if closed successfully.