Module Simula

Class RTS_Outbytefile

All Implemented Interfaces:
Runnable

public class RTS_Outbytefile extends RTS_Bytefile
System class Outbytefile.
  bytefile class outbytefile;
     begin
           Boolean procedure open;
           Boolean procedure close;
           procedure outbyte(x); short integer x;
           procedure outtext(t); text t;
           Boolean procedure checkpoint;
 
  end outbytefile;
 
An object of the class "outbytefile" is used to represent a sequential output file of bytes.

Link to GitHub: Source File.

Author:
SIMULA Standards Group, Øystein Myhre Andersen
  • Field Details

    • outputStream

      private OutputStream outputStream
      The OutputStream used.
  • Constructor Details

    • RTS_Outbytefile

      public RTS_Outbytefile(RTS_RTObject SL, RTS_TXT FN)
      Create a new _Outbytefile.
      Parameters:
      SL - staticLink
      FN - file name
  • Method Details

    • _STM

      public RTS_Outbytefile _STM()
      Description copied from class: RTS_RTObject
      Method representing the Statements in this Block
      This method is virtual and must be redefined in blocks.
      Overrides:
      _STM in class RTS_Bytefile
      Returns:
      a pointer to this _RTObject
    • open

      public boolean open()
      The procedure open.
       Boolean procedure open;
          if ... then begin ...
             BYTESIZE := ... ! value of access mode BYTESIZE;
             open     := OPEN := true;
       end open;
       
      Returns:
      true:ok, false:error
    • close

      public boolean close()
      The procedure close.
       Boolean procedure close;
          if OPEN then begin ...
             OPEN   := false;
             close  := true;
       end close;
       
      Returns:
      true:ok, false:error
    • outbyte

      public void outbyte(int b)
      Procedure outbyte.

      The procedure "outbyte" outputs a byte corresponding to the parameter value. If the parameter value is less than zero or exceeds the maximum permitted value, as defined by BYTESIZE, a runtime error occurs.

      If the file is not open, a run-time error occurs.

      Parameters:
      b - the byte to output
      Throws:
      RTS_SimulaRuntimeError - if the operations fail
    • out2byte

      public void out2byte(int b)
      Procedure out2byte.

      The procedure "out2byte" outputs a byte corresponding to the parameter value.

      If the file is not open, a run-time error occurs.

      Parameters:
      b - the integer to output
      Throws:
      RTS_SimulaRuntimeError - if the operations fail
    • outtext

      public void outtext(RTS_TXT t)
      Procedure outtext. It outputs all characters in the parameter "t" as bytes.
       procedure outtext(t);   text t;
          begin
             t.setpos(1);
             while t.more do outbyte(rank(t.getchar))
       end outtext;
       
      Parameters:
      t - the argument text
    • checkpoint

      public boolean checkpoint()
      Procedure checkpoint.

      All files producing output (sequential output or direct files) contain a Boolean procedure "checkpoint". The procedure causes the environment to attempt to secure the output produced so far. Depending on the nature of the associated external device, this causes completion of output transfer (i.e. intermediate buffer contents are transferred). If this is not possible or meaningful, "checkpoint" is a dummy operation in which case the value false is returned.

      Returns:
      true:ok, false:error