Deprecated readLine method

Posted on 2006-04-27
Last Modified: 2008-01-09
 The .readLine is deprecated for string, what would I use instead to still read a  line of string?

           FileInputStream fstream = new
         DataInputStream in = new DataInputStream(fstream);
           String line;
                  while((line =in.readLine()) != null) {
Question by:kellyputty
    LVL 92

    Accepted Solution

    Use BufferedReader instead

    BufferedReader in = new BufferedReader(new InputStreamReader(fstream));

    Author Comment

    ah that worked,

    my confusion was with this part:
    new InputStreamReader(fstream)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    Title # Comments Views Activity
    twoTwo  challenge 35 71
    sameEnds challenge 25 55
    countAbc challenge 9 35
    Unable to start eclipse ? 17 43
    For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
    By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
    Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now