openStream() private method

private openStream ( ) : global::java.io.InputStream
return global::java.io.InputStream
コード例 #1
0
        public string DownloadString(Uri u)
        {
            var w = new StringBuilder();

            try
            {
                var url    = new java.net.URL(u.ToString());
                var i      = new java.io.InputStreamReader(url.openStream(), "UTF-8");
                var reader = new java.io.BufferedReader(i);

                // can't we just read to the end?
                var line = reader.readLine();
                while (line != null)
                {
                    w.AppendLine(line);

                    line = reader.readLine();
                }
                reader.close();
            }
            catch
            {
                // oops
            }

            return(w.ToString());
        }
コード例 #2
0
ファイル: ThreadLoginVerifier.cs プロジェクト: riverar/Crafty
 public override void run()
 {
     try
     {
         string s = NetLoginHandler.getServerId(loginHandler);
         var url =
             new URL(
                 (new StringBuilder()).append("http://www.minecraft.net/game/checkserver.jsp?user="******"&serverId=").append(s).toString());
         var bufferedreader = new BufferedReader(new InputStreamReader(url.openStream()));
         string s1 = bufferedreader.readLine();
         bufferedreader.close();
         if (s1.Equals("YES"))
         {
             NetLoginHandler.setLoginPacket(loginHandler, loginPacket);
         }
         else
         {
             loginHandler.kickUser("Failed to verify username!");
         }
     }
     catch (Exception exception)
     {
         exception.printStackTrace();
     }
 }
コード例 #3
0
        public static string ToWebString(this Uri u)
        {
            var w = new StringBuilder();

            try
            {
                var url = new URL(u.ToString());
                var i = new InputStreamReader(url.openStream());
                var reader = new BufferedReader(i);

                var line = reader.readLine();
                while (line != null)
                {
                    w.AppendLine(line);

                    line = reader.readLine();
                }
                reader.close();
            }
            catch
            {
                // oops
            }

            return w.ToString();
        }
コード例 #4
0
        public string DownloadString(Uri u)
        {
            var w = new StringBuilder();

            try
            {
                var url = new java.net.URL(u.ToString());
                var i = new java.io.InputStreamReader(url.openStream(), "UTF-8");
                var reader = new java.io.BufferedReader(i);

                // can't we just read to the end?
                var line = reader.readLine();
                while (line != null)
                {
                    w.AppendLine(line);

                    line = reader.readLine();
                }
                reader.close();
            }
            catch
            {
                // oops
            }

            return w.ToString();
        }