SysInStream.
Inheritance: InStream
コード例 #1
0
 public Map meta()
 {
     if (m_meta == null)
     {
         try
         {
             if (fpod.m_meta != null)
             {
                 m_meta = (Map)fpod.m_meta;
             }
             else
             {
                 InStream input = new SysInStream(fpod.m_store.read("meta.props"));
                 m_meta = (Map)input.readProps().toImmutable();
                 input.close();
             }
         }
         catch (Exception e)
         {
             Err.dumpStack(e);
             m_meta = Sys.m_emptyStrStrMap;
         }
     }
     return(m_meta);
 }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
 public override InStream @in(Long bufSize)
 {
     try
     {
         System.IO.Stream stream = (m_file as FileInfo).OpenRead();
         return(SysInStream.make(stream, bufSize));
     }
     catch (System.IO.IOException e)
     {
         throw IOErr.make(e).val;
     }
 }
コード例 #4
0
//////////////////////////////////////////////////////////////////////////
// Documentation
//////////////////////////////////////////////////////////////////////////

        public string doc()
        {
            if (!m_docLoaded)
            {
                try
                {
                    Stream input = fpod.m_store.read("doc/pod.fandoc");
                    if (input != null)
                    {
                        m_doc = SysInStream.make(input, Long.valueOf(1024L)).readAllStr();
                    }
                }
                catch (Exception e)
                {
                    Err.dumpStack(e);
                }
                m_docLoaded = true;
            }
            return(m_doc);
        }
コード例 #5
0
ファイル: Process.cs プロジェクト: syatanic/fantom
        //////////////////////////////////////////////////////////////////////////
        // Handlers
        //////////////////////////////////////////////////////////////////////////

        private void inHandler()
        {
            System.IO.Stream input  = SysInStream.dotnet(m_in);
            System.IO.Stream output = m_proc.StandardInput.BaseStream;
            byte[]           temp   = new byte[256];

            while (!m_proc.HasExited)
            {
                try
                {
                    int n = input.Read(temp, 0, temp.Length);
                    if (n < 0)
                    {
                        break;
                    }
                    output.Write(temp, 0, n);
                    output.Flush();
                }
                catch (System.Exception e)
                {
                    Err.dumpStack(e);
                }
            }
        }
コード例 #6
0
 private Zip(InStream ins)
 {
     this.m_zipIn = new ZipInputStream(SysInStream.dotnet(ins));
 }
コード例 #7
0
ファイル: Pod.cs プロジェクト: nomit007/f4
 public Map meta()
 {
     if (m_meta == null)
       {
     try
     {
       if (fpod.m_meta != null) m_meta = (Map)fpod.m_meta;
       else
       {
     InStream input = new SysInStream(fpod.m_store.read("meta.props"));
     m_meta = (Map)input.readProps().toImmutable();
     input.close();
       }
     }
     catch (Exception e)
     {
       Err.dumpStack(e);
       m_meta = Sys.m_emptyStrStrMap;
     }
       }
       return m_meta;
 }
コード例 #8
0
ファイル: TcpSocketPeer.cs プロジェクト: nomit007/f4
 internal void connected(TcpSocket fan)
 {
     IPEndPoint endPoint = m_dotnet.RemoteEndPoint as IPEndPoint;
       m_remoteAddr = IpAddrPeer.make(endPoint.Address);
       m_remotePort = endPoint.Port;
       m_in  = SysInStream.make(new NetworkStream(m_dotnet), getInBufferSize(fan));
       m_out = SysOutStream.make(new NetworkStream(m_dotnet), getOutBufferSize(fan));
 }
コード例 #9
0
ファイル: TcpSocketPeer.cs プロジェクト: nomit007/f4
 public void close()
 {
     m_dotnet.Close();
       m_in  = null;
       m_out = null;
       m_closed = true;
 }
コード例 #10
0
ファイル: FPod.cs プロジェクト: nomit007/f4
        private void readPodMeta(FStore.Input input)
        {
            // handle sys bootstrap specially using just java.util.Properties
              string metaName;
              if ("sys" == m_podName)
              {
            Properties props = new Properties();
            props.load(input);
            input.Close();
            metaName =  props.getProperty("pod.name");
            m_podVersion = props.getProperty("pod.version");
            m_fcodeVersion = props.getProperty("fcode.version");
            m_depends = new Depend[0];
            return;
              }
              else
              {
            SysInStream sysIn = new SysInStream(input);
            this.m_meta = (Map)sysIn.readProps().toImmutable();
            sysIn.close();

            metaName = meta("pod.name");
            m_podVersion = meta("pod.version");

            m_fcodeVersion = meta("fcode.version");
            string dependsStr = meta("pod.depends").Trim();
            if (dependsStr.Length == 0) m_depends = new Depend[0];
            else
            {
              string[] toks = dependsStr.Split(';');
              m_depends = new Depend[toks.Length];
              for (int i=0; i<m_depends.Length; ++i) m_depends[i] = Depend.fromStr(toks[i].Trim());
            }
              }

              // check meta name matches podName passed to ctor
              if (m_podName == null) m_podName = metaName;
              if (m_podName != metaName)
            throw new System.IO.IOException("Pod name mismatch " + m_podName + " != " + metaName);

              // sanity checking
              if (FConst.FCodeVersion != m_fcodeVersion)
            throw new System.IO.IOException("Invalid fcode version " + m_fcodeVersion);
        }
コード例 #11
0
ファイル: EnvIndex.cs プロジェクト: nomit007/f4
 private static void loadPod(Hashtable index, string n, FileSystemInfo f)
 {
     ZipFile zip = new ZipFile(f.FullName);
       try
       {
     ZipEntry entry = zip.GetEntry("index.props");
     if (entry != null)
     {
       SysInStream input = new SysInStream(new BufferedStream(zip.GetInputStream(entry)));
       addProps(index, input.readPropsListVals());
     }
       }
       finally
       {
     zip.Close();
       }
 }