• Post Reply Bookmark Topic Watch Topic
  • New Topic

Best way to load a text file from URL?  RSS feed

 
David Llewellyn
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Ive got an applet containing a URL that I want to load a text file from.
What is the best way to do this? I read somewhere that certain methods such as getURLContent do not work on all java installations so i was wondering what is better to use?

cheers
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getURLContent? I'm not familiar with that method in any version of the JDK.
 
David Llewellyn
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that case, do you know any way to load a text file from a URL?
I would like to read it line by line, using a buffered reader for example.

thanks
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at java.net.URL and java.net.URLConnection. These classes lets you open resources over a network, and get them as Streams.
 
David Llewellyn
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cheers, will do
 
Nigel Browne
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This will help you along the way.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!