Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Tuesday at 12:30 PM
Ad icon
ඉන්ටර්නෙට් එකෙන් හරියටම සල්ලි හොයන්න සහ Success වෙන්න කැමතිද? 🚀 (E-Money & Success Stories)
siri sumana
Updated:
Saturday at 11:44 PM
Gemini AI PRO 18 months Offer
Hawaka
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
JAVA
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="akhilapraveen" data-source="post: 10765281" data-attributes="member: 104181"><p>MACHAN MAMA UMBATA WEBPAGE EKAK READ KARALA EKE TIYANA TEXT EKA GANNE KOHOMADA KIYALA KIYANNAM!</p><p></p><p>this is how you read a URL!!!</p><p></p><p><span style="color: Blue">import java.io.BufferedReader;</span></p><p><span style="color: Blue">import java.io.IOException;</span></p><p><span style="color: Blue">import java.io.InputStreamReader;</span></p><p><span style="color: Blue">import java.net.URL;</span></p><p><span style="color: Blue">import java.util.*;</span></p><p><span style="color: Blue">import java.io.*;</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue">public class ReadWebPage {</span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue"> public String readnow(String txt){</span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> String LINexxx="";</span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> //String LINe="";</span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> String txt1=txt;</span></p><p><span style="color: Blue"> try{</span></p><p><span style="color: Blue"> String urltext = txt1;</span></p><p><span style="color: Blue"> URL url = new URL(urltext);</span></p><p><span style="color: Blue"> BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));</span></p><p><span style="color: Blue"> String line = "";</span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> while ((line = in.readLine()) != null){</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue"> // System.out.println(line);</span></p><p><span style="color: Blue"> String line1="";</span></p><p><span style="color: Blue"> //line1=in.readLine();</span></p><p><span style="color: Blue"> line1=line;</span></p><p><span style="color: Blue"> LINexxx=(LINexxx+"----------"+line1);</span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> }</span></p><p><span style="color: Blue"> in.close();</span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> return LINexxx;</span></p><p> <span style="color: Blue"></span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> }</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue"> catch (Exception e)</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue"> {</span></p><p><span style="color: Blue"> String Er="error is occured";</span></p><p><span style="color: Blue"> return Er;</span></p><p><span style="color: Blue"> //System.out.println(e.toString());</span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> }</span></p><p><span style="color: Blue"> </span></p><p> <span style="color: Blue">}</span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue">}</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue">pass the web address with http to readnow method!</span></p><p><span style="color: Blue">ex=http://www.google.lk/</span></p><p><span style="color: Blue"></span></p></blockquote><p></p>
[QUOTE="akhilapraveen, post: 10765281, member: 104181"] MACHAN MAMA UMBATA WEBPAGE EKAK READ KARALA EKE TIYANA TEXT EKA GANNE KOHOMADA KIYALA KIYANNAM! this is how you read a URL!!! [COLOR=Blue]import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.util.*; import java.io.*; public class ReadWebPage { public String readnow(String txt){ String LINexxx=""; //String LINe=""; String txt1=txt; try{ String urltext = txt1; URL url = new URL(urltext); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); String line = ""; while ((line = in.readLine()) != null){ // System.out.println(line); String line1=""; //line1=in.readLine(); line1=line; LINexxx=(LINexxx+"----------"+line1); } in.close(); return LINexxx; } catch (Exception e) { String Er="error is occured"; return Er; //System.out.println(e.toString()); } } } pass the web address with http to readnow method! ex=http://www.google.lk/ [/COLOR] [/QUOTE]
Insert quotes…
Verification
Hath warak paha keeyada? (hatha wadikireema paha)
Post reply
Top
Bottom