Use this:

        import java.io.*;

        public String FileToString(String PathFile) throws Exception {
                File file = new File(PathFile);
                String FileContents = "";
                if ( file == null )
                        throw new Exception("Unknown error!");
                else if ( !file.exists() )
                        throw new Exception("The file '" + PathFile + "'
does not exist or was not found.");
                else {
                        FileReader reader = new FileReader(file);
                        int Length = (int)file.length();
                        char[] content = new char[Length];
                        reader.read(content, 0, Length);
                        FileContents = new String(content);
                }
                return FileContents;
        }

-----Original Message-----
From: Ganesh Mohan Rao [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 20, 2000 12:52 PM
To: [EMAIL PROTECTED]
Subject: (Off Topic) Please Bare with ME!!!


Dear All,

Please bare with me for this Off Topic Question.

I would like to know whether there is a possiblity of reading the contents
of a files at one stretch.

Now I am using FileReader and Buffer Reader in which I am using Readline()
method which reads line by line.

My PL wants to read the Content as a whole in one operation.

Is that possible?

Please help me out ASAP.

I have to report to my PL.

Once Again Please bare with me for this Off Topic Question.

Ganesh.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to