OutStream.
Inheritance: FanObj
Example #1
0
 //////////////////////////////////////////////////////////////////////////
 // .NET Conversion
 //////////////////////////////////////////////////////////////////////////
 /// <summary>
 /// Get a System.IO.Stream for the specified output stream.
 /// </summary>
 public static Stream dotnet(OutStream outs)
 {
     if (outs is SysOutStream)
     return ((SysOutStream)outs).outStream;
       else
     return new DotnetOutputStream(outs);
 }
Example #2
0
 public void print(OutStream @out)
 {
     lock (@out)
       {
     @out.printLine(toStr());
     if (m_err != null) m_err.trace(@out, null, 2, true);
       }
 }
Example #3
0
 //////////////////////////////////////////////////////////////////////////
 // Construction
 //////////////////////////////////////////////////////////////////////////
 public BootEnv()
 {
     this.m_args    = initArgs();
       this.m_vars    = initVars();
       this.m_host    = initHost();
       this.m_user    = initUser();
       this.m_in      = new SysInStream(Console.OpenStandardInput());
       this.m_out     = new SysOutStream(Console.OpenStandardOutput());
       this.m_err     = new SysOutStream(Console.OpenStandardError());
       this.m_homeDir = new LocalFile(new DirectoryInfo(Sys.m_homeDir), true).normalize();
       this.m_tempDir = m_homeDir.plus(Uri.fromStr("temp/"), false);
 }
Example #4
0
 public DotnetOutputStream(OutStream outs)
 {
     this.outs = outs;
 }
Example #5
0
 public virtual long pipe(OutStream output, Long n)
 {
     return pipe(output, n, true);
 }
Example #6
0
File: Err.cs Project: nomit007/f4
 public Err trace(OutStream @out, Map opt, int indent, bool useActual)
 {
     Exception ex = m_actual != null && useActual ? m_actual : val;
       dumpStack(toStr(), ex, @out, indent);
       if (m_cause != null)
       {
     @out.printLine("Cause:");
     m_cause.trace(@out, opt, indent+2, useActual);
       }
       return this;
 }
Example #7
0
 public void err(OutStream err)
 {
     checkRun(); this.m_err = err;
 }
Example #8
0
 public static void make_(OutStream self, OutStream output)
 {
     self.m_out = output;
 }
Example #9
0
File: Err.cs Project: nomit007/f4
 public Err trace(OutStream @out)
 {
     return trace(@out, null, 0, true);
 }
Example #10
0
 public Err trace(OutStream @out)
 {
     return(trace(@out, null, 0, true));
 }
Example #11
0
 /// <summary>
 /// Dump a readable stack trace.
 /// </summary>
 public static void dumpStack(Exception err, OutStream @out)
 {
     dumpStack(err.Message, err, @out, 0);
 }
Example #12
0
File: Zip.cs Project: nomit007/f4
 //////////////////////////////////////////////////////////////////////////
 // GZIP
 //////////////////////////////////////////////////////////////////////////
 public static OutStream gzipOutStream(OutStream o)
 {
     throw UnsupportedErr.make("Zip.gzipOutStream").val;
 }
Example #13
0
 //////////////////////////////////////////////////////////////////////////
 // Constructor
 //////////////////////////////////////////////////////////////////////////
 public ObjEncoder(OutStream @out, Map options)
 {
     this.@out = @out;
       if (options != null) initOptions(options);
 }
Example #14
0
File: Zip.cs Project: nomit007/f4
 private Zip(OutStream outs)
 {
     this.m_zipOut = new ZipOutputStream(SysOutStream.dotnet(outs));
 }
Example #15
0
File: Zip.cs Project: nomit007/f4
 public static Zip write(OutStream outs)
 {
     return new Zip(outs);
 }
Example #16
0
 public override void encode(char ch, OutStream output)
 {
     ((StrBufOutStream)output).m_sb.Append(ch);
 }
Example #17
0
 public static void make_(OutStream self, OutStream output)
 {
     self.m_out = output;
       if (output != null) self.charset(output.charset());
 }
Example #18
0
 public virtual long pipe(OutStream output, Long toPipe, bool cls)
 {
     try
       {
     long bufSize = FanInt.Chunk.longValue();
     Buf buf = Buf.make(bufSize);
     long total = 0;
     if (toPipe == null)
     {
       while (true)
       {
     Long n = readBuf(buf.clear(), bufSize);
     if (n == null) break;
     output.writeBuf(buf.flip(), buf.remaining());
     total += n.longValue();
       }
     }
     else
     {
       long toPipeVal = toPipe.longValue();
       while (total < toPipeVal)
       {
     if (toPipeVal - total < bufSize) bufSize = toPipeVal - total;
     Long n = readBuf(buf.clear(), bufSize);
     if (n == null) throw IOErr.make("Unexpected end of stream").val;
     output.writeBuf(buf.flip(), buf.remaining());
     total += n.longValue();
       }
     }
     return total;
       }
       finally
       {
     if (cls) close();
       }
 }
Example #19
0
 public Err trace(OutStream @out, Map opt)
 {
     return(trace(@out, opt, 0, true));
 }
Example #20
0
 public abstract void encode(char ch, OutStream @out);
Example #21
0
 //////////////////////////////////////////////////////////////////////////
 // Construction
 //////////////////////////////////////////////////////////////////////////
 public static OutStream make(OutStream output)
 {
     OutStream self = new OutStream();
       make_(self, output);
       return self;
 }
Example #22
0
 public override void encode(char ch, OutStream @out)
 {
     cbuf[0] = ch;
     int len = charset.m_encoding.GetBytes(cbuf, 0, 1, bbuf, 0);
     for (int i=0; i<len; i++)
       @out.w(bbuf[i]);
 }
Example #23
0
File: Err.cs Project: nomit007/f4
 public static void dumpStack(string msg, Exception err, OutStream @out, int indent)
 {
     StringWriter w = new StringWriter();
       doDumpStack(msg, err, indent, w);
       @out.writeChars(w.ToString()).flush();
 }
Example #24
0
 public override void encode(char c, OutStream @out)
 {
     if (c > 0xFF) throw IOErr.make("Invalid ISO-8859-1 char").val;
     @out.w((c >> 0) & 0xFF);
 }
Example #25
0
File: Err.cs Project: nomit007/f4
 public Err trace(OutStream @out, Map opt)
 {
     return trace(@out, opt, 0, true);
 }
Example #26
0
 public override void encode(char c, OutStream @out)
 {
     @out.w((c >> 0) & 0xFF)
     .w((c >> 8) & 0xFF);
 }
Example #27
0
File: Err.cs Project: nomit007/f4
 /// <summary>
 /// Dump a readable stack trace.
 /// </summary>
 public static void dumpStack(Exception err, OutStream @out)
 {
     dumpStack(err.Message, err, @out, 0);
 }
Example #28
0
 public override void encode(char c, OutStream @out)
 {
     if (c <= 0x007F)
     {
       @out.w(c);
     }
     else if (c > 0x07FF)
     {
       @out.w(0xE0 | ((c >> 12) & 0x0F))
       .w(0x80 | ((c >>  6) & 0x3F))
       .w(0x80 | ((c >>  0) & 0x3F));
     }
     else
     {
       @out.w(0xC0 | ((c >>  6) & 0x1F))
       .w(0x80 | ((c >>  0) & 0x3F));
     }
 }
Example #29
0
 public void @out(OutStream @out)
 {
     checkRun(); this.m_out = @out;
 }
Example #30
0
 public DotnetOutputStream(OutStream outs)
 {
     this.outs = outs;
 }
Example #31
0
 public override void encode(char ch, OutStream output)
 {
     ((StrBufOutStream)output).m_sb.Append(ch);
 }
Example #32
0
 public virtual long pipe(OutStream output)
 {
     return pipe(output, null, true);
 }