예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("static-access") public void run()
        public virtual void run()
        {
            valuesRow = new string[this.MaxCounter];
            for (int i = 0; i < this.MaxCounter; i++)
            {
                InputStream @is = null;
                try
                {
                    string       surl = "http://download.finance.yahoo.com/d/quotes.csv?s=^GDAXI&f=sl1d1t1c1ohgv&e=.csv";
                    java.net.URL url  = new java.net.URL(surl);
                    @is = url.openStream();
                    BufferedReader dis = new BufferedReader(new InputStreamReader(@is));
                    string         s   = dis.readLine();
                    System.Console.WriteLine(s);
                    valuesRow[i] = s;
                    @is.close();
                }
                catch (java.net.MalformedURLException mue)
                {
                    System.Console.WriteLine("Ouch - a MalformedURLException happened.");
                    System.Console.WriteLine(mue.ToString());
                    System.Console.Write(mue.StackTrace);
                    Environment.Exit(1);
                }
                catch (IOException ioe)
                {
                    System.Console.WriteLine("Oops- an IOException happened.");
                    System.Console.WriteLine(ioe.ToString());
                    System.Console.Write(ioe.StackTrace);
                    Environment.Exit(1);
                }
                try
                {
                    Thread.Sleep(Tsleep);
                }
                catch (java.lang.InterruptedException)
                {
                }
            }             //end of for
            System.Console.WriteLine("valuesRow.length=" + valuesRow.Length);
        }
예제 #2
0
        /// <summary>
        /// Creates a new URLInputAdapter by opening a connection to URL specified by the input param </summary>
        /// <param name="url"> URL object to connect to. </param>
        /// <exception cref="IOException"> if connection  </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public URLInputAdapter(java.net.URL url) throws java.io.IOException
        public URLInputAdapter(java.net.URL url) : base(new BufferedReader(new InputStreamReader(url.openStream())))
        {
        }