Buffered reader need help

Hello!
I'm useless at java and am trying to complete a piece of code i just don't get!
I'm reading in a text file and don't know how to complete the buffered reader section of it can anyone help!
p
the code is as follows.
// Author:
// Date:
// The creation of the League class
// saved as League.java to hold and manipulate icehockey team data
import java.io.*;
import java.lang.*;
import java.util.*;
class League
private static Team teams[]=new Team[6];
League()
String tName;
String tNickname;
String nPlayed;
String nWon;
String nLost;
String nDrawn;
try
FileReader fr=new FileReader("Results.txt");
//got the following syntax from p436
BufferedReader br=new BufferedReader(fr);
//confused!!!!     
int i=0;
while()
// dunno if this is right!
StringTokenizer st = new StringTokenizer(fr);
while (st.hasMoreTokens())
//will this work?
tName=inputStream.sval;inputStream.nextToken();
tNickname=inputStream.sval;inputStream.nextToken();
nPlayed=(int)inputStream.nval;inputStream.nextToken();
nWon=(int)inputStream.nval;inputStream.nextToken();
nLost=(int)inputStream.nval;inputStream.nextToken();
nDrawn=(int)inputStream.nval;inputStream.nextToken();
//whats this bit about? new team instance to be written!
//teams=;
i++;
fr.close();
br.close();
//catch exception thing wrote this dunno if it works or not
catch (Exception e)
if (e instanceof FileNotFoundException)
system.out.println("Filename"+Results.txt+"not found")
     //     public int getSize()
               //to be written
     //     public Team getTeam(int i)               
               //to be written

try somethign along these lines...
    try {
        BufferedReader in = new BufferedReader(new FileReader("infilename"));
        String str;
        while ((str = in.readLine()) != null) {
            process(str);
        in.close();
    } catch (IOException e) {
    }

Similar Messages

  • Hey please read need help with ipod

    how do I set my playlist so if i hook up my ipod it only downloads my songs but if anyone else hooks up there ipod there songs won't come into my playlist? PLEASE HELP
    Message was edited by: Alissa-55

    first of all, i'm not sure if i understand your question fully but i believe you just want your OWN playlist so that you can put the songs YOU want on it and no one ELSE can put their music in it?
    if that's the case, you just need to make your own playlist on your ipod.
    open up itunes and near the top, select "file".
    select "new playlist".
    this new playlist should appear on the left-hand side of itunes under 'playlists' right at the bottom. when it appears, it will read 'untitled playlist'. click it once then again, so that you are able to name the playlist to your liking.
    when it comes to putting songs into your own playlist, you can drag any song from your itunes library. choose a song from your itunes library and drag it over to your designated playlist til you see your playlist is outlined with blue and your cursor has a plus sign just below it.
    hope that helps.

  • Reading need help though Class not found

    Hi, I normally search the forums before posting but I need some points cleared up
    What version of JDK does IE ship with? Since the depricated size().getHeight() is only supported and not the newer version.
    This isnt my real question though. MY applet which only uses a canvas, hashmap, arraylist, sockets and a couple of other things does not work :-(
    IE claims it cannot find the HASHMAP class. Ive used full qualifers shown below and the html called. Can someone tell me how to solve this problem pls?
    I have also read about using a .JAR file with all my bits in it. How do i create this and use it?
    Thanks people
    // A hashmap allows for a key and an object.  Should aid speed
      private java.util.HashMap m_hashmap = new java.util.HashMap(400, (float)0.75);
      <HTML>
    <APPLET
    CODE=mainApp.class width=800 height=600>
    <param name="bgColour" value="255,255,255">
    <param name="host" value="nutcracker">
    <param name="port" value="23">
    </APPLET>
    </html>
    Error msg
    ava.lang.ClassNotFoundException: java.util.HashMap
         at com/ms/vm/loader/URLClassLoader.loadClass
         at java/lang/ClassLoader.loadClassInternal
         at InternalDataStructures.<init>

    The plugin is in fact a virtual machine that runs your applet. When a browser hits a page that requires use of a plugin that's not installed yet, there will be a prompt to download it. Once it's installed the plugin will take control and load your classes from the internet and the load the API classes you need from its own rt.jar, located locally. The only slowdown may be the initial bringing up of the VM.
    Also note that the latest versions of many browsers like opera and netscape begin to ship with the plugin; no need to download anything.
    Can I not package up the classes in my own JAR?Of course you can, but there may be some legal points that I'm not aware of... In total, the plugin would be the best solution for everyone (you're not the only one writing applets, are you :) but because of its download size your users may appreciate you extracting the needed few kilos from rt.jar ;)

  • Cannot use adobe reader. need help please

    when i click the desktop icon it says to run the program. well when i click that it says "please wait while adobe reader 9.3.4 update setup is being processed.". and than nothing. nothing happens at all. im extremely frustrated because im sure this is just a simple problem that i cant seem to figure out. any help would be awsome

    I have the same problem, but I can't uninstall Adobe Reader 9.  I have XP operating system.  I get a message about "package not available" or some such.  It MAY be incompatibility with MS Internet Explorer.

  • SIM not reading, Need help fast due to being abroad!!

    My iPhone 4 was working perfectly until about an hour ago when I received an error message stating I have no sim. I restarted the phone several times with no luck. Then I restored all settings through the iPhone with no luck until I turned my phone off for 3 mintues and upon turning it back on (I was unable to reset the phone because I have no computer back up and no WiFi because of the no SIM) the tmobile signal appeared. I was able to connect to wifi to reset my phone which it is in the processes of doing. But after 5 minutes the NO SIM appeared where tmobile appeared. I am in Austria for another 3 weeks and this is my only connection back to home and I am not even able to contact someone to tell them what is happening. If anyone has ANY solutions that does not involve going to an ATT store (my phones original carrier) to replace the SIM card since I am not capable to do so it would be greatly appreciated. Thank you so much for your time
    Scarlett

    Try this (copied from http://support.apple.com/kb/TS2802):
    Remove the SIM card.
    Verify that the SIM card is not damaged or dirty, then reinstall the SIM card.
    Try turning iPhone off and then on again.
    Wait approximately two minutes, then see if iPhone detects the SIM card and if it will register on the network.
    If that doesn't work, try another SIM card for that carrier, if possible, to see if it is detected.
    If the message still exists, please go to: apple.com/support/iphone/service/faq/ for information on service.
    Note: If you need to send your iPhone in for service or if you want to temporarily use a different phone, you may be able to use the SIM card inside your iPhone with another GSM phone.

  • Toshiba 3TB Hard drive can't be read, need help

    Model: DT01ACA300    3TB Sata 3 Internal Hard drive"The disk check could not be performed because Windows can't access the disk."
    Speedfan reports that the fitness and the performance of the disk are both pretty high, almost 95%.
    This means that it's connected and it doesn't have any internal damage.
    "F:/ is not accessible. Access is denied." I think this means the drive is fine, but something weird is preventing it from working. So the drive is connected and is registered with the system, but I can't view any files and it says it's not accessible. It's very important to me not to lose any data, so what do I do to restore it back to working order? Is there a system tool that I can use, or maybe a boot disk that might work? How do I determine what the problem is? Could it be the MBR?The disk cannot be read on either of the two systems I've used it on, and neither by direct SATA connection or by external adapter USB connection. -If I send the drive in for warranty repair, can they fix it and return it with all my data on it, or would they send me a new drive that's blank? Here are some pictures:

    The drive is about 2 years old and I bought it off of Newegg. I think I formatted it in Windows [or it came formatted] but I don't recall it having any problem with that. I first used it on a Windows 8 system and I've also used it on a Windows 7 system before it stopped working. I have both Windows 7 and Windows 8.1 available. It's currently on the Windows 8.1 which is an Intel desktop. This is also where the pictures came from.It is currently connected directly via SATA to my motherboard, and it seems to show up when the system is booting up. It is connected to the computer the same way as about 4 other drives, and it's the only one that has any problems. The problem comes from the error messages, and I really can't figure out what it is that could be causing the problem. The drive hasn't really been used much. A lot of data has been transferred to it [maybe 2TB] but it has very low usage and it's only been in the computer for about a year. Is there a hard disk utility that I can use to diagnose what the problem is? It seems like Windows probably knows far more about the problem than I do: how would I find that out?

  • How can I add a new Template to My Templates in Pages? I've read most of the discussions on the subject but it doesn't work for me. By the time I reach the Templates folder, I only see templates for Numbers and not for Pages. Need help, please.  Thanks

    How can I add a new Template to My Templates in Pages? I've read most of the discussions on the subject but it doesn't work for me. By the time I reach the Templates folder, I only see templates for Numbers and not for Pages. Need help, please.  Thanks

    Si vous avez utilisé la commande Save As Template depuis Pages, il y a forcément un dossier
    iWork > Pages
    contenant Templates > My Templates
    comme il y a un dossier
    iWork > Numbers
    contenant Templates > My Templates
    Depuis le Finder, tapez cmd + f
    puis configurez la recherche comme sur cette recopie d'écran.
    puis lancez la recherche.
    Ainsi, vous allez trouver vos modèles personnalisés dans leur dossier.
    Chez moi, il y en a une kyrielle en dehors des dossiers standards parce que je renomme wxcvb.template quasiment tous mes documents Pages et wxcvb.nmbtemplate à peu près tous mes documents Numbers.
    Ainsi, quand je travaille sur un document, je ne suis pas ralenti par Autosave.
    Désolé mais je ne répondrai plus avant demain.
    Pour moi il est temps de dormir.
    Yvan KOENIG (VALLAURIS, France)  mercredi 23 janvier 2011 22:39:28
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • My little brother messed up with my iPod touch 4th Gen by entering the wrong password , now all data is beeing erased what should I do.The iPod is just showing the Apple Logo and some buffering icon below it.Need help fast!I'm really worried!

    I really need help this has happend 5 hours ago and the ipod os still showing the apple logo and the buffering icon below it!
    It re booted several times till now.
    Need help fast!

    - I suspect that he went to Settings>General>Reset>Erase all content and settings.  For 1G or 2G iPod that can take hours and it will likely stall out if not connected to a charging source.
    Try the following:
    - A reset.
    Reset iPod touch:  Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - The connect to computer and try to restore via iTunes.
    - Id something is still showing onthe screen, disconnect from computer/charging source and let the battery fully drain. After charging for an hour, Try the reset and restore.
    - If you can turn the iPod off, se if placing the iPod in recovery mode and then restore. For recovey mode:
    iPhone and iPod touch: Unable to update or restore

  • I need help in resolving a problem that prevents me from accessing the iTunes store.  Message reads " iTunes cannot contact the iTunes store" and also says that my laptop is no longer authorized to access my account.  Help!

    I need help in resolving a problem that prevents me from accessing the iTunes store.  Message reads " iTunes cannot contact the iTunes store" and also says that my laptop is no longer authorized to access my account.  Help!

    Go up to the top of your screen on iTunes and click on 'Store'.  Then go down to 'Authorize This Computer'.  That should cover part of it unless you've already authorized a bunch of other computers to use your account.  If that's the case, you'll have to go to one of those computers and click the button just below it to 'deauthorize your account' from that computer.  If you're not able to access the store, check your internet connection to make sure you are connected.  Hope this helps.. good luck!     

  • URGENT: Need help reading URL of current page

    Hello kind people!
    I need help, and its very simple:
    How do i read the URL of a web page?
    For example, the URL of this page is:
    http://forums.sun.com/thread.jspa?threadID=5327796
    So how can i be able to read in this URL in my java program?
    thanks SO MUCH
    P.S. I HAVE searched the java docs and everything, the closest thing i found was request.getRequestURL().? but i have no idea how to use it. you have NO IDEA how appreciative i would be if you could simply show me exactly how to read in the URL of a given page.
    thanks SO MUCH
    Edited by: homegrownpeas on Aug 31, 2008 5:19 PM

    Going by what I understand here is a simple version of how you can read data from over HTTP.
    This expects the "page" to be text (hence an InputStreamReader instead of an InputStream.)
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.net.URLConnection;
    import java.util.HashMap;
    * GPLv2.
    * @author karlm816
    public class HomeGrownPeas {
          * @param args
         public static void main(String[] args) {
              HashMap<String, String> params = new HashMap<String, String>();
              params.put("threadID", "5327796");
              System.out.println(loadHttpPage("http://forums.sun.com/thread.jspa", params));     
         public static String loadHttpPage(String sUrl, HashMap<String, String> params) {
              // Build the HTTP request string
              StringBuilder sb = new StringBuilder();
              if (params != null) {
                   for (String key : params.keySet()) {
                        if (sb.length() > 0) {
                             sb.append("&");
                        sb.append(key);
                        sb.append("=");
                        sb.append(params.get(key));
              System.out.println("params: " + sb.toString());
              try {
                   URL url = new URL(sUrl);
                   URLConnection connection = url.openConnection();
                   connection.setDoOutput(true);
                   connection.setRequestProperty("Content-Length", "" + sb.length());
                   connection.setUseCaches(false);
                   if (connection instanceof HttpURLConnection) {
                        HttpURLConnection conn = (HttpURLConnection) connection;
                        conn.setRequestMethod("POST");
                   OutputStreamWriter osw = new OutputStreamWriter(connection.getOutputStream());
                   osw.write(sb.toString());
                   osw.close();
                   // Now use sb to hold the resutls from the request
                   sb = new StringBuilder();
                   BufferedReader in = new BufferedReader(
                         new InputStreamReader(
                         connection.getInputStream()));
                   String s;
                   while ((s = in.readLine()) != null) {
                        sb.append(s);
                        // To make it more "human readable"
                        sb.append("\n");
                   in.close();
             } catch (IOException e) {
                  e.printStackTrace();
                  return null;
            return sb.toString();
    }

  • Need Help in reading data from URLConnection in servlets

    hi i created GUI which sends d username n password to the servlets via URLConnection.n am sending the same to Server program via sockets.but when i read d data in the servlet am getting only null value...need help here....
    This is my button's ActionPerformed code
    private void LoginActionPerformed(java.awt.event.ActionEvent evt) {
    String uname = UserName.getText();
    char [] pwd = PassWord.getPassword();
    String pword = new String(pwd);
    try
    String url = "http://localhost:8080/MIMServlets/hit";
    URL ucon = new URL(url);
    URLConnection conn = ucon.openConnection();
    conn.setDoOutput(true);
    conn.setDoInput(true);
              conn.setUseCaches (false);
    conn.setDefaultUseCaches (false);
    conn.setRequestProperty("Content-Type", "text/plain");
    System.out.println(uname);
         System.out.println(pword);
         PrintWriter out = new PrintWriter( conn.getOutputStream() );
    BufferedReader in = new BufferedReader(
    new InputStreamReader(
    conn.getInputStream()));
         out.print(uname);
    out.print(pword);
         out.close();
    String inputLine = in.readLine();
    Status.setText(inputLine);// TODO add your handling code here:
    }catch(MalformedURLException e)
    System.out.println("Exception"+e);
    catch(IOException e1)
    System.out.println("Exception"+e1);
    This is my Servlet code........
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class MIMServlets extends HttpServlet
    PrintWriter out,out1;
         BufferedReader in,in1;
         String host = "localhost";
         String fromServer = "";
         String username,password;
         int a;
         public void init()
    out=null;
    out1=null;
    public void doPost(HttpServletRequest request,HttpServletResponse
                   response)throws ServletException,IOException
              response.setContentType("text/html");
              out=response.getWriter();
              try{
              InetAddress address = InetAddress.getByName(host);
    Socket theSocket = new Socket(address, 4444);
    out1 = new PrintWriter(theSocket.getOutputStream(),true);
    in = new BufferedReader(new InputStreamReader(theSocket.getInputStream()));
    in1 = new BufferedReader(new InputStreamReader(request.getInputStream()));
              String username = in1.readLine();
              String password = in1.readLine();
    System.out.println(username);
              System.out.println(password);
    out1.println(username);
              out1.println(password);
              out1.println("Yahoo");
              out1.flush();
    while ((fromServer = in.readLine()) != null)
    out.println("From Server: " + fromServer);
              break;
         out1.close();
    in.close();
    theSocket.close();
         }catch(IOException e)
    System.out.println("Exception");
    System.exit(-1);
              public void destroy()
         out.close();
    thanks in advance.......

    Follow below example to using FM 'READ_TEXT'
    DATA  BEGIN OF i_tlines OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA  END   OF i_tlines.
    DATA: w_textname(70) TYPE c.
      w_textname = vbdkr-vbeln.
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
          client                        = sy-mandt
          id                            = 'Z006'
          language                      = 'E'
          name                          = w_textname
          object                        = 'VBBK'
        TABLES
          lines                         = i_tlines.
      IF sy-subrc = 0.
        READ TABLE i_tlines INDEX 1.
        t_in-m1 = i_tlines-tdline.   "Now t_in_m1 will have the value
      ENDIF.
    Regards,
    SaiRam

  • Adobe reader not working. Needs help badly!!

    I get this error  message and will not read or open my PDF files pissing me off Please read and why is this doing this and how
    do I fix this. Not happy!!
    My error messge I get. I need help badly to fox this !!
    Adobe reader could not open micro niche 14 Internet Marketing (1) zip because it is either not supported file type because the file
    has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).
    Can anybody Please help  me !!!!!!!!!!!!!!!!!!!!!!!!!!
    Michael Ladd and email is [removed]

    Adobe Reader cannot open ZIP files. It only opens PDF files.

  • Need help with Adobe Reader 9

    About three weeks ago my computer started acting crazy so I tried to run updates but I could not get on the internet because the comcast guy told me that it was my firewall. So I disabled my firewall and put on windows firewall and was able to do my updates, but then my antivirus quit working so then I uninstalled it and tried to reinstall but I could not. So I got mad and tried to restore to my last restore point but it would not let me, so when I went to run check disk Windows popped up and said it could not perform this action because the disk was busy.So I then called my friend whorepairs computers and he came over and ran combofix and installed a new antivirus. Combofix said nothing was wrong, but I still can't do system restore or checkdiscso I ran MalwareBytes and it comes up with nothing. So now all of a sudden Windows is telling me that Adobe reader 9 is corrupt and unreadable. Everytime I try to uninstall it, it won't let me. Everytime I try to install a newer version I can't because a pop up comes up and says I alredy have the file, but I can't use it to read my PDFs for class. Adobe reader 9 is messing my computer up and I need help removing it?

    Hello,this is me again. I ran Windows install utility cleanup and basically uninstalled all Adobe files, but when I was done I went into the program files on C drive to delete Adobe file and it gave me an error that said: An unexpected error is preventing the operation.Make a note of this error code,which might be useful if you get additional help to resolve this problem.Error 0x80070091: The directory is not empty. And I still cannot run check disc because it tells me that the disk is busy.

  • Need help with how to call VB proceedure to open Adobe reader pdf file from differnt folders

    Using  MS access 9.0.2720  visual basic proceedure to call Adobe reader to open a specific flle from a folder on my c drive.
    useing the shell command , shellexecute is not available in the version I'm using.
    I can call the Reader with this code:   call shell "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe"  and it will open reader, but
    I can't seem to get it to open a specific PDF file, I tried
    call shell "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" & "(folderpath)\.95.pdf"
    This use to work when I was running Xp and acrobat 5.0 , I am currentlt running windows 7
    thanks in advance..

    I am getting the exact error trying to down load bank statements but when I go to 'uncheck' the "Do not save encrypted page to disk" box it is ALREADY unchecked.  Can't get my bank statements down loaded.  Any other suggestions.  Need help quick.

  • I need help with a PDF file that is an image, the "Read Out Loud' option does not work, please help!

    I need help with a PDF file that is an image, the "Read Out Loud' option does not work, please help!

    You mean an image such as a scanned document?
    If that is the case, the file doesn't contain any text for Reader Out Loud to read. In order to fix that, you would need an application such as Adobe Acrobat that does Optical Character Recognition to convert the images to actual text.
    You can also try to export the file as a Word document or something else using ExportPDF which I believe offers OCR and is cheaper than Acrobat.

Maybe you are looking for