bigloo.output_string_port.close C# (CSharp) Method

close() public method

public close ( ) : Object
return Object
        public override Object close()
        {
            try
              {
            byte[] result= ((((MemoryStream)stream).Length == 0)     // !!!!! PNet bug !!!!
            ? new byte[0]
            : ((MemoryStream)stream).ToArray());

            stream.Close();
            stream = null;
            base.close();
            return result;
              }
              catch (Exception  e)
              {
            if (stream == null)
              return bigloo.foreign.BUNSPEC;
            else
              foreign.fail( "close", e.Message, this );

            return this;
              }
        }

Usage Example

Example #1
0
        public override String ToString()
        {
            output_port strstream = new output_string_port();

              write( strstream );

              Object r = strstream.close();

              if (r is byte[])
            return foreign.newstring( (byte[])r );

              return ("<obj " + GetType().ToString() + ">");
        }