OutStream.
Inheritance: FanObj
Ejemplo n.º 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);
 }
Ejemplo n.º 2
0
 public void print(OutStream @out)
 {
     lock (@out)
       {
     @out.printLine(toStr());
     if (m_err != null) m_err.trace(@out, null, 2, true);
       }
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 4
0
 public DotnetOutputStream(OutStream outs)
 {
     this.outs = outs;
 }
Ejemplo n.º 5
0
 public virtual long pipe(OutStream output, Long n)
 {
     return pipe(output, n, true);
 }
Ejemplo n.º 6
0
Archivo: Err.cs Proyecto: 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;
 }
Ejemplo n.º 7
0
 public void err(OutStream err)
 {
     checkRun(); this.m_err = err;
 }
Ejemplo n.º 8
0
 public static void make_(OutStream self, OutStream output)
 {
     self.m_out = output;
 }
Ejemplo n.º 9
0
Archivo: Err.cs Proyecto: nomit007/f4
 public Err trace(OutStream @out)
 {
     return trace(@out, null, 0, true);
 }
Ejemplo n.º 10
0
 public Err trace(OutStream @out)
 {
     return(trace(@out, null, 0, true));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Dump a readable stack trace.
 /// </summary>
 public static void dumpStack(Exception err, OutStream @out)
 {
     dumpStack(err.Message, err, @out, 0);
 }
Ejemplo n.º 12
0
Archivo: Zip.cs Proyecto: nomit007/f4
 //////////////////////////////////////////////////////////////////////////
 // GZIP
 //////////////////////////////////////////////////////////////////////////
 public static OutStream gzipOutStream(OutStream o)
 {
     throw UnsupportedErr.make("Zip.gzipOutStream").val;
 }
Ejemplo n.º 13
0
 //////////////////////////////////////////////////////////////////////////
 // Constructor
 //////////////////////////////////////////////////////////////////////////
 public ObjEncoder(OutStream @out, Map options)
 {
     this.@out = @out;
       if (options != null) initOptions(options);
 }
Ejemplo n.º 14
0
Archivo: Zip.cs Proyecto: nomit007/f4
 private Zip(OutStream outs)
 {
     this.m_zipOut = new ZipOutputStream(SysOutStream.dotnet(outs));
 }
Ejemplo n.º 15
0
Archivo: Zip.cs Proyecto: nomit007/f4
 public static Zip write(OutStream outs)
 {
     return new Zip(outs);
 }
Ejemplo n.º 16
0
 public override void encode(char ch, OutStream output)
 {
     ((StrBufOutStream)output).m_sb.Append(ch);
 }
Ejemplo n.º 17
0
 public static void make_(OutStream self, OutStream output)
 {
     self.m_out = output;
       if (output != null) self.charset(output.charset());
 }
Ejemplo n.º 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();
       }
 }
Ejemplo n.º 19
0
 public Err trace(OutStream @out, Map opt)
 {
     return(trace(@out, opt, 0, true));
 }
Ejemplo n.º 20
0
 public abstract void encode(char ch, OutStream @out);
Ejemplo n.º 21
0
 //////////////////////////////////////////////////////////////////////////
 // Construction
 //////////////////////////////////////////////////////////////////////////
 public static OutStream make(OutStream output)
 {
     OutStream self = new OutStream();
       make_(self, output);
       return self;
 }
Ejemplo n.º 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]);
 }
Ejemplo n.º 23
0
Archivo: Err.cs Proyecto: 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();
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 25
0
Archivo: Err.cs Proyecto: nomit007/f4
 public Err trace(OutStream @out, Map opt)
 {
     return trace(@out, opt, 0, true);
 }
Ejemplo n.º 26
0
 public override void encode(char c, OutStream @out)
 {
     @out.w((c >> 0) & 0xFF)
     .w((c >> 8) & 0xFF);
 }
Ejemplo n.º 27
0
Archivo: Err.cs Proyecto: nomit007/f4
 /// <summary>
 /// Dump a readable stack trace.
 /// </summary>
 public static void dumpStack(Exception err, OutStream @out)
 {
     dumpStack(err.Message, err, @out, 0);
 }
Ejemplo n.º 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));
     }
 }
Ejemplo n.º 29
0
 public void @out(OutStream @out)
 {
     checkRun(); this.m_out = @out;
 }
Ejemplo n.º 30
0
 public DotnetOutputStream(OutStream outs)
 {
     this.outs = outs;
 }
Ejemplo n.º 31
0
 public override void encode(char ch, OutStream output)
 {
     ((StrBufOutStream)output).m_sb.Append(ch);
 }
Ejemplo n.º 32
0
 public virtual long pipe(OutStream output)
 {
     return pipe(output, null, true);
 }