Skip to main content

ModelCenter Remote Execution Java API 2025 R2

Class: PHXMonitorableStream

Last update: 16.07.2025

Package: com.phoenix_int.aserver.monitors

Class Hierarchy

↳ java.lang.Object
  ↳ com.phoenix_int.aserver.monitors.PHXMonitorableStream

Declaration

public class PHXMonitorableStream
extends java.lang.Object

This class represents a stream of data which may be monitored by a client which supports progress monitors. To use this class, implement the IPHXMonitorable interface and return instances of this class.

 public class monitorableComp implements IPHXAnalysis, IPHXMonitorable
 {
   private PHXMonitorableStream mon1 = new PHXMonitorableStream();
   private PHXMonitorableStream mon2 = new PHXMonitorableStream();
   ...
   public execute() throws Exception
   {
     //Do Stuff
     mon1.clear();
     mon2.clear();
     mon1.append("Starting");
     Writer w = mon2.getWriter();
     w.write("Beginning first phase");
     ...
   }
   public PHXProcessInfo[] listProcesses() throws IOException
   {
     throws IOException("Not supported");
   }
   public String[] listMonitorableFiles() throws IOException;
   {
     String[] mons = new String[2];
     mons[0] = "monitor1";
     mons[1] = "monitor2";
     return mons;
   }
   public Object getMonitor(String m)
      throws PHXNoSuchObjectException;
   {
      if ( "monitor1".equals(m) )
         return mon1;
      if ( "monitor2".equals(m) )
         return mon2;
      throw new PHXNoSuchObjectException(m);
   }
 }

Nested Class Summary

Nested classes

Modifier and Type Class and Description
class PHXMonitorableStream.MonitorWriter

Constructor Summary

Constructor and Description
PHXMonitorableStream()
Default Constructor

Method Summary

Modifier and Type Method and Description
void addMonitorListener(IPHXFileCallback cb)
Adds a listener which gets events based on changes to this monitor
void append(java.lang.String text)
Appends a string to this monitor
void clear()
Clears the contents of this monitor
java.lang.String getString()
Gets the current contents of the stream
java.io.Writer getWriter()
Gets a java.io.Writer which when written to appends onto this monitor
void removeMonitorListener(IPHXFileCallback cb)
Removes a listener from this monitor

Methods inherited from class java.lang.Object

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

Constructor Detail

PHXMonitorableStream

public PHXMonitorableStream()

Default Constructor

Method Detail

addMonitorListener

public void addMonitorListener(IPHXFileCallback cb)

Adds a listener which gets events based on changes to this monitor

removeMonitorListener

public void removeMonitorListener(IPHXFileCallback cb)

Removes a listener from this monitor

getWriter

public java.io.Writer getWriter()

Gets a java.io.Writer which when written to appends onto this monitor

clear

public void clear()

Clears the contents of this monitor

getString

public java.lang.String getString()

Gets the current contents of the stream

append

public void append(java.lang.String text)

Appends a string to this monitor

Connect with Ansys