OutStream.
Inheritance: FanObj
コード例 #1
0
ファイル: SysOutStream.cs プロジェクト: nomit007/f4
 //////////////////////////////////////////////////////////////////////////
 // .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);
 }
コード例 #2
0
ファイル: LogRec.cs プロジェクト: nomit007/f4
 public void print(OutStream @out)
 {
     lock (@out)
       {
     @out.printLine(toStr());
     if (m_err != null) m_err.trace(@out, null, 2, true);
       }
 }
コード例 #3
0
ファイル: BootEnv.cs プロジェクト: nomit007/f4
 //////////////////////////////////////////////////////////////////////////
 // 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);
 }
コード例 #4
0
ファイル: SysOutStream.cs プロジェクト: syatanic/fantom
 public DotnetOutputStream(OutStream outs)
 {
     this.outs = outs;
 }
コード例 #5
0
ファイル: InStream.cs プロジェクト: nomit007/f4
 public virtual long pipe(OutStream output, Long n)
 {
     return pipe(output, n, true);
 }
コード例 #6
0
ファイル: Err.cs プロジェクト: 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;
 }
コード例 #7
0
ファイル: Process.cs プロジェクト: nomit007/f4
 public void err(OutStream err)
 {
     checkRun(); this.m_err = err;
 }
コード例 #8
0
ファイル: OutStream.cs プロジェクト: nomit007/f4
 public static void make_(OutStream self, OutStream output)
 {
     self.m_out = output;
 }
コード例 #9
0
ファイル: Err.cs プロジェクト: nomit007/f4
 public Err trace(OutStream @out)
 {
     return trace(@out, null, 0, true);
 }
コード例 #10
0
ファイル: Err.cs プロジェクト: syatanic/fantom
 public Err trace(OutStream @out)
 {
     return(trace(@out, null, 0, true));
 }
コード例 #11
0
ファイル: Err.cs プロジェクト: syatanic/fantom
 /// <summary>
 /// Dump a readable stack trace.
 /// </summary>
 public static void dumpStack(Exception err, OutStream @out)
 {
     dumpStack(err.Message, err, @out, 0);
 }
コード例 #12
0
ファイル: Zip.cs プロジェクト: nomit007/f4
 //////////////////////////////////////////////////////////////////////////
 // GZIP
 //////////////////////////////////////////////////////////////////////////
 public static OutStream gzipOutStream(OutStream o)
 {
     throw UnsupportedErr.make("Zip.gzipOutStream").val;
 }
コード例 #13
0
ファイル: ObjEncoder.cs プロジェクト: nomit007/f4
 //////////////////////////////////////////////////////////////////////////
 // Constructor
 //////////////////////////////////////////////////////////////////////////
 public ObjEncoder(OutStream @out, Map options)
 {
     this.@out = @out;
       if (options != null) initOptions(options);
 }
コード例 #14
0
ファイル: Zip.cs プロジェクト: nomit007/f4
 private Zip(OutStream outs)
 {
     this.m_zipOut = new ZipOutputStream(SysOutStream.dotnet(outs));
 }
コード例 #15
0
ファイル: Zip.cs プロジェクト: nomit007/f4
 public static Zip write(OutStream outs)
 {
     return new Zip(outs);
 }
コード例 #16
0
ファイル: StrBufOutStream.cs プロジェクト: syatanic/fantom
 public override void encode(char ch, OutStream output)
 {
     ((StrBufOutStream)output).m_sb.Append(ch);
 }
コード例 #17
0
ファイル: OutStream.cs プロジェクト: xored/f4
 public static void make_(OutStream self, OutStream output)
 {
     self.m_out = output;
       if (output != null) self.charset(output.charset());
 }
コード例 #18
0
ファイル: InStream.cs プロジェクト: nomit007/f4
 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();
       }
 }
コード例 #19
0
ファイル: Err.cs プロジェクト: syatanic/fantom
 public Err trace(OutStream @out, Map opt)
 {
     return(trace(@out, opt, 0, true));
 }
コード例 #20
0
ファイル: Charset.cs プロジェクト: nomit007/f4
 public abstract void encode(char ch, OutStream @out);
コード例 #21
0
ファイル: OutStream.cs プロジェクト: nomit007/f4
 //////////////////////////////////////////////////////////////////////////
 // Construction
 //////////////////////////////////////////////////////////////////////////
 public static OutStream make(OutStream output)
 {
     OutStream self = new OutStream();
       make_(self, output);
       return self;
 }
コード例 #22
0
ファイル: Charset.cs プロジェクト: nomit007/f4
 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]);
 }
コード例 #23
0
ファイル: Err.cs プロジェクト: 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();
 }
コード例 #24
0
ファイル: Charset.cs プロジェクト: nomit007/f4
 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);
 }
コード例 #25
0
ファイル: Err.cs プロジェクト: nomit007/f4
 public Err trace(OutStream @out, Map opt)
 {
     return trace(@out, opt, 0, true);
 }
コード例 #26
0
ファイル: Charset.cs プロジェクト: nomit007/f4
 public override void encode(char c, OutStream @out)
 {
     @out.w((c >> 0) & 0xFF)
     .w((c >> 8) & 0xFF);
 }
コード例 #27
0
ファイル: Err.cs プロジェクト: nomit007/f4
 /// <summary>
 /// Dump a readable stack trace.
 /// </summary>
 public static void dumpStack(Exception err, OutStream @out)
 {
     dumpStack(err.Message, err, @out, 0);
 }
コード例 #28
0
ファイル: Charset.cs プロジェクト: nomit007/f4
 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));
     }
 }
コード例 #29
0
ファイル: Process.cs プロジェクト: nomit007/f4
 public void @out(OutStream @out)
 {
     checkRun(); this.m_out = @out;
 }
コード例 #30
0
ファイル: SysOutStream.cs プロジェクト: nomit007/f4
 public DotnetOutputStream(OutStream outs)
 {
     this.outs = outs;
 }
コード例 #31
0
ファイル: StrBufOutStream.cs プロジェクト: nomit007/f4
 public override void encode(char ch, OutStream output)
 {
     ((StrBufOutStream)output).m_sb.Append(ch);
 }
コード例 #32
0
ファイル: InStream.cs プロジェクト: nomit007/f4
 public virtual long pipe(OutStream output)
 {
     return pipe(output, null, true);
 }