InStream interface.
Inheritance: FanObj
示例#1
0
 //////////////////////////////////////////////////////////////////////////
 // .NET Conversion
 //////////////////////////////////////////////////////////////////////////
 /// <summary>
 /// Get a System.IO.Stream for the specified input stream.
 /// </summary>
 public static Stream dotnet(InStream ins)
 {
     if (ins is SysInStream)
     return ((SysInStream)ins).inStream;
       else
     return new DotnetInputStream (ins);
 }
示例#2
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);
 }
示例#3
0
文件: ObjDecoder.cs 项目: nomit007/f4
 //////////////////////////////////////////////////////////////////////////
 // Constructor
 //////////////////////////////////////////////////////////////////////////
 /// <summary>
 /// Construct for input stream.
 /// </summary>
 public ObjDecoder(InStream @in, Map options)
 {
     tokenizer = new Tokenizer(@in);
       this.options = options;
       consume();
 }
示例#4
0
文件: Charset.cs 项目: nomit007/f4
 public override void encode(char c, InStream @out)
 {
     if (c <= 0x007F)
     {
       @out.unread(c);
     }
     else if (c > 0x07FF)
     {
       @out.unread(0x80 | ((c >>  0) & 0x3F))
       .unread(0x80 | ((c >>  6) & 0x3F))
       .unread(0xE0 | ((c >> 12) & 0x0F));
     }
     else
     {
       @out.unread(0x80 | ((c >>  0) & 0x3F))
       .unread(0xC0 | ((c >>  6) & 0x1F));
     }
 }
示例#5
0
文件: Charset.cs 项目: nomit007/f4
 public override int decode(InStream @in)
 {
     int c = @in.r();
     if (c < 0) return -1;
     int c2, c3;
     switch (c >> 4)
     {
       case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
     /* 0xxxxxxx*/
     return c;
       case 12: case 13:
     /* 110x xxxx   10xx xxxx*/
     c2 = @in.r();
     if ((c2 & 0xC0) != 0x80)
       throw IOErr.make("Invalid UTF-8 encoding").val;
     return ((c & 0x1F) << 6) | (c2 & 0x3F);
       case 14:
     /* 1110 xxxx  10xx xxxx  10xx xxxx */
     c2 = @in.r();
     c3 = @in.r();
     if (((c2 & 0xC0) != 0x80) || ((c3 & 0xC0) != 0x80))
       throw IOErr.make("Invalid UTF-8 encoding").val;
     return (((c & 0x0F) << 12) | ((c2 & 0x3F) << 6) | ((c3 & 0x3F) << 0));
       default:
     throw IOErr.make("Invalid UTF-8 encoding").val;
     }
 }
示例#6
0
文件: InStream.cs 项目: nomit007/f4
 public static void make_(InStream self, InStream input)
 {
     self.m_in = input;
 }
示例#7
0
文件: Process.cs 项目: nomit007/f4
 public void @in(InStream @in)
 {
     checkRun(); this.m_in = @in;
 }
示例#8
0
文件: Charset.cs 项目: nomit007/f4
 public abstract void encode(char ch, InStream @out);
示例#9
0
文件: Charset.cs 项目: nomit007/f4
            public override int decode(InStream @in)
            {
                // TODO - well shit, how do we know how many bytes to read generically?

                int len = 1;
                int b = @in.r();
                if (b < 0) return -1;

                bbuf[0] = (byte)b;

                cbuf = charset.m_encoding.GetChars(bbuf, 0, len);
                return cbuf[0];
            }
示例#10
0
文件: Zip.cs 项目: nomit007/f4
 public static InStream gzipInStream(InStream i)
 {
     throw UnsupportedErr.make("Zip.gzipInStream").val;
 }
示例#11
0
文件: Charset.cs 项目: nomit007/f4
 public abstract int decode(InStream @in);
示例#12
0
文件: Zip.cs 项目: nomit007/f4
 private Zip(InStream ins)
 {
     this.m_zipIn = new ZipInputStream(SysInStream.dotnet(ins));
 }
示例#13
0
文件: Zip.cs 项目: nomit007/f4
 public static Zip read(InStream ins)
 {
     return new Zip(ins);
 }
示例#14
0
 public override void encode(char ch, InStream input)
 {
     throw UnsupportedErr.make("binary write on StrBuf output").val;
 }
示例#15
0
文件: Tokenizer.cs 项目: nomit007/f4
 //////////////////////////////////////////////////////////////////////////
 // Construction
 //////////////////////////////////////////////////////////////////////////
 /// <summary>
 /// Construct for specified input stream.
 /// </summary>
 public Tokenizer(InStream @in)
 {
     m_in = @in;
       consume();
       consume();
 }
示例#16
0
文件: Charset.cs 项目: nomit007/f4
 public override void encode(char ch, InStream @out)
 {
     // TODO - how does this work?
 }
示例#17
0
文件: Pod.cs 项目: nomit007/f4
        public static Pod load(InStream @in)
        {
            FPod fpod = null;
              try
              {
            fpod = new FPod(null, null);
            fpod.readFully(new ZipInputStream(SysInStream.dotnet(@in)));
              }
              catch (Exception e)
              {
            throw Err.make(e).val;
              }

              string name = fpod.m_podName;
              lock (m_podsByName)
              {
            // check for duplicate pod name
            if (m_podsByName[name] != null)
              throw Err.make("Duplicate pod name: " + name).val;

            // create Pod and add to master table
            Pod pod = new Pod(fpod);
            m_podsByName[name] = pod; //new SoftReference(pod);
            return pod;
              }
        }
示例#18
0
文件: Charset.cs 项目: nomit007/f4
 public override int decode(InStream @in)
 {
     return @in.r();
 }
示例#19
0
 public static InStream gzipInStream(InStream i)
 {
     throw UnsupportedErr.make("Zip.gzipInStream").val;
 }
示例#20
0
文件: Charset.cs 项目: nomit007/f4
 public override int decode(InStream @in)
 {
     int c1 = @in.r();
     int c2 = @in.r();
     if ((c1 | c2) < 0) return -1;
     return (c1 | (c2 << 8));
 }
示例#21
0
 public DotnetInputStream(InStream ins)
 {
     this.ins = ins;
 }
示例#22
0
文件: Charset.cs 项目: nomit007/f4
 public override void encode(char c, InStream @out)
 {
     @out.unread((c >> 8) & 0xFF)
     .unread((c >> 0) & 0xFF);
 }
示例#23
0
 public override void encode(char ch, InStream input)
 {
     throw UnsupportedErr.make("binary write on StrBuf output").val;
 }
示例#24
0
文件: InStream.cs 项目: nomit007/f4
 //////////////////////////////////////////////////////////////////////////
 // Construction
 //////////////////////////////////////////////////////////////////////////
 public static InStream make(InStream input)
 {
     InStream self = new InStream();
       make_(self, input);
       return self;
 }