• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

applet ----> URL -------> txt file

How can I do to access from an applet to an URL using "URL input stream" and from this URL to a txt file which is in a specific server?

I also need to know a way to read a txt file and extract strings, which are separated by something, for example a ",".


thank you very much
cristian

0
crisoft
Asked:
crisoft
1 Solution
 
jwilcoxCommented:
For your way to extract strings you can use the StringTokenizer interface. Here is an example of how that works...

String FullOfColons = new String("My Mom;and I; went to the bank; and put in; a lot of money!); // Actually full of Semi-Colons!

StringTokenizer KillGrammar = new StringTokenizer(FullOfColons, ";", false) // False if you don't want the ; included, true if you do!

String RealSentence = new String();
while( KillGrammar.hasMoreTokens() )
{
  RealSentence += KillGrammar.nextToken();
}

System.out.println(RealSentence);

StringTokenizer is in java.util.

Hope this gets you atleast started on your solution.
0
 
rainmalCommented:
To access a text file , access ot in the same way as you would a html file.
just make sure that you keep the text file in the Documents directory of your server
then access it using the URL.
For example

HTTP://yourservername/Doc.txt.

To parse through a string , refer to jwilcox's comment.
0
 
crisoftAuthor Commented:
HTTP://yourservername/Doc.txt.

Can you give me the code in java for this?
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now