com.ibm.as400.micro
Class DataQueue

java.lang.Object
  |
  +--com.ibm.as400.micro.DataQueue

public final class DataQueue
extends java.lang.Object

The DataQueue class represents an iSeries data queue object. This class provides a modified subset of the functions available in com.ibm.as400.access.DataQueue.

The following example demonstrates the use of DataQueue:

   AS400 system = new AS400("mySystem", "myUserid", "myPwd", "myMEServer");
   try
   {
       // Write to the Data Queue.
       DataQueue.write(system, "/QSYS.LIB/FRED.LIB/MYDTAQ.DTAQ", "some text");
       
       // Read from the Data Queue.
       String txt = DataQueue.read(system, "/QSYS.LIB/FRED.LIB/MYDTAQ.DTAQ");
   }
   catch (Exception e)
   {
       // Handle the exception
   }
   // Done with the system object.
   system.disconnect();
  

See Also:
DataQueue

Method Summary
static byte[] readBytes(AS400 system, java.lang.String path)
          Reads an entry from the data queue.
static java.lang.String readString(AS400 system, java.lang.String path)
          Reads an entry from the data queue.
static void write(AS400 system, java.lang.String path, byte[] data)
          Writes an entry to the data queue.
static void write(AS400 system, java.lang.String path, java.lang.String data)
          Writes an entry to the data queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readBytes

public static byte[] readBytes(AS400 system,
                               java.lang.String path)
                        throws java.io.IOException,
                               MEException
Reads an entry from the data queue.
Parameters:
system - The system on which the data queue exists.
path - The fully qualified integrated file system path name of the data queue.
buffer - the buffer into which the data is read.
Returns:
the total number of bytes read into the buffer. If no entries were available, null is returned.
Throws:
java.io.IOException - If an error occurs while communicating with the server.
MEException - If an error occurs while processing the ToolboxME request.

readString

public static java.lang.String readString(AS400 system,
                                          java.lang.String path)
                                   throws java.io.IOException,
                                          MEException
Reads an entry from the data queue.
Parameters:
system - The system on which the data queue exists.
path - The fully qualified integrated file system path name of the data queue.
Returns:
The entry read from the queue. If no entries were available, null is returned.
Throws:
java.io.IOException - If an error occurs while communicating with the server.
MEException - If an error occurs while processing the ToolboxME request.

write

public static void write(AS400 system,
                         java.lang.String path,
                         java.lang.String data)
                  throws java.io.IOException,
                         MEException
Writes an entry to the data queue.
Parameters:
system - The system on which the data queue exists.
path - The fully qualified integrated file system path name of the data queue.
data - The string to write to the queue.
Throws:
java.io.IOException - If an error occurs while communicating with the server.
MEException - If an error occurs while processing the ToolboxME request.

write

public static void write(AS400 system,
                         java.lang.String path,
                         byte[] data)
                  throws java.io.IOException,
                         MEException
Writes an entry to the data queue.
Parameters:
system - The system on which the data queue exists.
path - The fully qualified integrated file system path name of the data queue.
data - The array of bytes to write to the queue.
Throws:
java.io.IOException - If an error occurs while communicating with the server.
MEException - If an error occurs while processing the ToolboxME request.