Class BrokerCompleteCollection

java.lang.Object
COM.activesw.api.client.BrokerCompleteCollection

public class BrokerCompleteCollection extends Object
This class is used as a container to collect various Broker objects. It is commonly used to hold the results of reading in from an export file, and can be used to create an export file as well.

Note that several of the objects in this collection are also container objects. Including an object in one of them can result in that object being placed in an export file or used during an import as well.

  • Field Details

  • Constructor Details

    • BrokerCompleteCollection

      public BrokerCompleteCollection()
      Constructor.
  • Method Details

    • read

      public static BrokerCompleteCollection read(Reader reader) throws BrokerException, IOException
      Creates a new BrokerCompleteCollection based upon textual input. The input is usually read from a file but does not have to be.

      Because the the reader can only be read from once, this method does not handle the old export file formats like readFile can.

      For best efficiency, do not pass in a BufferedReader, because the underlying parser already performs read buffering.

      Throws:
      IOException - If there is an error reading.
      BrokerInputParseException - If there is a parse error in the text.
      BrokerNullParameterException - If reader is null.
      BrokerException
    • readFile

      public static BrokerCompleteCollection readFile(String filename) throws BrokerException, IOException
      Creates a new BrokerCompleteCollection based upon textual input read from a file.

      If the file does not use the most current file format, an attempt will be made to re-read the file using the old file format (from previous releases.) A BrokerInputParseException thrown when reading from a file using an old format does not provide the line number when there is an error.

      Throws:
      IOException - If there is an error reading.
      BrokerInputParseException - If there is a parse error in the text.
      BrokerNullParameterException - If filename is null.
      BrokerException
    • writeVersionNumber

      public static void writeVersionNumber(Writer writer, int indent_level) throws BrokerException, IOException
      Writes a version number string. This is usually done at the top of any file written out using the write method of this or any other BrokerComplete class. The inclusion of the file format version at the top of the exported file is not mandatory.

      This method is separated from the write functions so you may control which parts of a collection are written to the file and write the version number of the file format only once, at the top.

      Throws:
      IOException - If there is an error writing.
      BrokerNullParameterException - If writer is null.
      BrokerOutOfRangeException - If indent_level is less than 0.
      BrokerException
    • write

      public void write(Writer writer, int indent_level, boolean escape_unicode) throws BrokerException, IOException
      Writes this object's information out in a textual format. This is usually done to a file. The indent_level is the number of 4 character indents to use.

      Unicode characters in the output are escaped using backslash-u notiation (e.g. ӿ) if the escape_unicode arguement is true. Set the escape_unicode arguement to false only if you desire native format unicode characters that can be more easily edited in locale editors. Unescaped unicode characters cannot be read again on every platform and locale.

      Does not write anything if all of the data members are null, or if all of them return empty strings when converted to strings.

      You may call this function repeatedly with the same writer to write multiple collections into the same file.

      Does not write the export file format version number to the file. Use writeVersionNumber once at the beginning of the file to do that.

      Throws:
      IOException - If there is an error writing to the file.
      BrokerNullParameterException - If writer is null.
      BrokerOutOfRangeException - If indent_level is less than 0.
      BrokerException
    • write

      public void write(Writer writer, int indent_level) throws BrokerException, IOException
      Writes this object's information out in a textual format. This is usually done to a file. The indent_level is the number of 4 character indents to use.

      Unicode characters in the output are escaped using backslash-u notiation (e.g. ӿ).

      Does not write anything if all of the data members are null, or if all of them return empty strings when converted to strings.

      You may call this function repeatedly with the same writer to write multiple collections into the same file.

      Does not write the export file format version number to the file. Use writeVersionNumber once at the beginning of the file to do that.

      Throws:
      IOException - If there is an error writing to the file.
      BrokerNullParameterException - If writer is null.
      BrokerOutOfRangeException - If indent_level is less than 0.
      BrokerException
    • toString

      public String toString(int indent_level) throws BrokerException
      Converts this object's information into a string. The string is in proper format for saving to a file. The indent_level is the number of 4 character indents to use.

      Unicode characters in the output are escaped using backslash-u notiation (e.g. ӿ).

      Returns an empty string if all of the data members are null, or if all of them return empty strings when converted to strings.

      Throws:
      BrokerOutOfRangeException - If indent_level is less than 0.
      BrokerException
    • toString

      public String toString()
      Converts this object's information into a string. The string is in proper format for saving to a file.

      Unicode characters in the output are escaped using backslash-u notiation (e.g. ӿ).

      Returns an empty string if all of the data members are null, or if all of them return empty strings when converted to strings.

      Overrides:
      toString in class Object