Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The println method appends CRLF (0x0D0x0A) to the end of the UTF-8 encoded bytes.

It is recommended not to embed "\n" in the String text, but use the print and println methods.

...

public interface JSMTrace

...


{

...


public void flush () ;

...



public int getNumber () ;

...



public File createTraceFile ( String fileName ) ;

...



public void print ( String text ) ;

...


public void println ( String text ) ;

...



public void println ( Object object1, Object object2 ) ;

...


public void println ( Object object1, Object object2, Object object3 ) ;

...


public void println ( Object object1, Object object2, Object object3, Object object4 ) ;

...


public void println ( Object object1, Object object2, Object object3, Object object4, Object object5 ) ;

...


public void println ( Object object1, Object object2, Object object3, Object object4, Object object5, Object object6 ) ;

...


public void println ( Object object1, Object object2, Object object3, Object object4, Object object5, Object object6, Object object7 ) ;

...


public void println ( Object object1, Object object2, Object object3, Object object4, Object object5, Object object6, Object object7, Object object8 ) ;

...



public void print ( Throwable throwable ) ;

...


public void print ( JSMCommand command ) ;

...


public void print ( JSMCommand command, JSMResponse response ) ;

...


public void print ( JSMCommand command, Throwable throwable ) ;

...


}

Example

...

    public final void service ( JSMContainer container )

...


   {

...


       m_trace = container.getServiceTrace () ;

...


   }

...



   public final JSMResponse command ( JSMCommand command ) throws JSMException

...


   {

...


       try

...


       {

...


           if ( m_trace != null )

...


           {

...


               m_trace.print ( command ) ;

...


           }

...



           JSMResponse response = runCommand ( command ) ;

...



           if ( m_trace != null )

...


           {

...


               m_trace.print ( command, response ) ;

...


           }

...



           return response ;

...


       }

...


       catch ( Throwable t )

...


       {

...


           if ( m_trace != null )

...


           {

...


               m_trace.print ( command, t ) ;

...


           }

...



          return new JSMResponse ( t ) ;

...


       }

...


   }

...



   private final JSMResponse runCommand ( JSMCommand command ) throws Exception

...


   {

...


      if ( command.equals ( command.SERVICE_LOAD ) )

...


      {

...


          return new JSMResponse ( "Command has completed" ) ;

...


      }

...



      return new JSMResponse ( JSMResponse.ERROR, "Unknown command" ) ;

...


  }