cdac.medinfo.sdk.hl7282.hl7net.auxiliaryprotocol.fragment

## Class FragmentAgent

- java.lang.Object
- - cdac.medinfo.sdk.hl7282.hl7net.auxiliaryprotocol.fragment.FragmentAgent

- All Implemented Interfaces:
    IFragmentProcessor

      public class FragmentAgent
      extends java.lang.Object
      implements IFragmentProcessor

  The Class FragmentAgent performs the fragmentation and defragmentation for HL7 messages It Fragments the messages according to the max length allowed. and reassembles the Fragments in one message as and when required.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FragmentAgent()` Instantiates a new fragment agent.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `HL7BufferStream` | `defragment(HL7BufferStream objHL7BufferStream)` Defragments The HL7BufferStream and returns Defragmented HL7BufferStream.
    `ISingleCollection<HL7BufferStream>` | `fragment(HL7BufferStream objHL7BufferStream)` Fragments The HL7BufferStream and returns Fragmented HL7BufferStream.
    `void` | `setMaxLength(int iLength)` Sets maximum length for fragments.

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

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

- - ### Constructor Detail

    - #### FragmentAgent

          public FragmentAgent()

      Instantiates a new fragment agent.

  - ### Method Detail

    - #### setMaxLength

          public void setMaxLength(int iLength)

      Sets maximum length for fragments.
      Specified by:
        `setMaxLength` in interface `IFragmentProcessor`
      Parameters:
        `iLength` - value of maximum fragment length.

    - #### fragment

          public ISingleCollection<HL7BufferStream> fragment(HL7BufferStream objHL7BufferStream)
                                                      throws java.io.IOException

      Fragments The HL7BufferStream and returns Fragmented HL7BufferStream. It adds required segments in fragments specified by HL7 standard.
      Specified by:
        `fragment` in interface `IFragmentProcessor`
      Parameters:
        `objHL7BufferStream` - HL7BufferStream to fragment.
      Returns:
        HL7BufferStream - Fragmented HL7BufferStream .
      Throws:
        `java.io.IOException` - Thrown when IO operation fails.

    - #### defragment

          public HL7BufferStream defragment(HL7BufferStream objHL7BufferStream)
                                     throws java.io.IOException

      Defragments The HL7BufferStream and returns Defragmented HL7BufferStream. Removes additional segments from fragments and generates the original HL7 Message.
      Specified by:
        `defragment` in interface `IFragmentProcessor`
      Parameters:
        `objHL7BufferStream` - HL7BufferStream to defragment.
      Returns:
        HL7BufferStream - Defragmented HL7BufferStream .
      Throws:
        `java.io.IOException` - Thrown when IO operation fails.