File I/O and StringTokenizer

Hi
This may be really simple, but I seem to have problem here. I am reading a txt file using FileReader and I am just printing it out. The txt file has lots of lines. What I want now is to take just the lines which has an = sign on it( there should be only one =) and print just that. This line in the txt file is the form key=value(a hashtable) I need to printout just those lines which are of these form key=value and ignore all the lines. I know I should use the StringTokenizer, but how do I read the.txt file and check if there is any blank line or illegal line and select the line with key=value and print it.
Please let me know.
Thanks

yourStuff() is a snippet that you will change with your source code.
The regular expression is:
"^\\w+=\\w+$"
It means: "from starting data input position (^) followed with one or more char in set [a-zA-Z0-9_] (\\w+), followed with an '=', followed with one or more char (\\w+) till the end of data input ($)".
It assures no more than one '=' in a line but since you can have blankspaces surrounding this char use that: "^\\w+\\s*=\\s*\\w+$".
The method "matches()" means "exactly matches" and using anchors: ^ and $, ie; exactly matches from start to end of data input.

Similar Messages

  • TS1368 I'm a PC user with an itunes account for several years. I updated my itunes and now it wont open and shows me 'missing file MSVCR80.dll,and error 7(Window error 126)' keep coming up even after re-installing itunes . What should i do?

    I'm a PC user with an itunes account for several years. I updated my itunes and now it wont open and shows me 'missing file MSVCR80.dll,and error 7(Window error 126)' keep coming up even after re-installing itunes . What should i do?

    Click here and follow the instructions.
    (98897)

  • Generally when creating a Word file from either a Mac or Win7 pc and opening it on two different machines (either one first) it always prompts that the file is open and will be opened as read only. However opening a CSS file does not prompt that it is alr

    Generally when creating a Word file from either a Mac or Win7 pc and opening it on two different machines (either one first) it always prompts that the file is open and will be opened as read only.
    However opening a CSS file does not prompt that it is already open on or from any machine which is causing code edits to be lost.
    What we found from out testing:
    - The file can be saved from one user to the server and WILL NOT PROMPT on other machines until the saving machine has the Dreamweaver program closed completely
    - The file can be closed and  Dreamweaver minimised to the launch bar but it still will not register on other machines that it has been changed.
    - Also, until the  Dreamweaver program is closed on the machines, it will continue to open it's saved version of the file. 
    Example Scenario:
    - User 1 opens test.css (which is 2000 lines) and adds some code to the end of the file to bring it up to 2500 lines
    - Meanwhile User 2 opens test.css as well (opens as 2000 lines as User 1’s edits have not yet been saved) and adds in code to bring it to 2300 lines
    - User 1 saves his file and closes it - but  Dreamweaver is still open.
    - User 2 also saves his file and leaves  Dreamweaver  open.
    - The server will report the size and last edit of the file the same as User 2 as he was the last person to save it (and if you open from the Win7 Machine it will show as User 2’s 2300 line version)
    - If User 1 then open's the file again (from either the 'recent' in Dreamweaver OR clicking on the file directly in Finder...which version opens.... The version that User 1 saved! Not the true version on the server, but the version that User 1 edited and saved with 2500 lines in it.
    - Same for User 2, he will open 'his' version with 2300 lines in.
    Other information:
    - Files are opened directly from the server
    - Sometimes the users will save incrementally and re-open
    - Most of the time users will save incrementally and keep the files open
    - The users will never not save incrementally and just save when closing the file once finished
    - The users are usually working on the files all day
    - It is always the bottom lines of code that are lost. It could be a case of the two versions being mixed up and cutting off the newly added lines based on the line count (possibly).
    It is as if Dreamweaver is holding a cache of the version locally and then only properly looking back to the server when it has been completely closed. It is very difficult to see how the server is causing such an impact on these files, there are very few logs which are giving any indication to the root cause of the problems.
    Anyone know if this is a known issue?
    Is there a way that there can be a featured implemented on the server that doesn't allow another user to open a file if it is already open on another machine?
    Thanks

    Your server file handling has nothing, and really nothing to do with Adobe software. If files don't get locked for (over-)writing and/or lose connection to the program opening them, then your server is misconfigured. It's as plain and simple and that. Anything from "known file types"/ file associations not being set correctly, MIME types being botched, crooked user privileges and file permissions, missing Mac server extensions, delayed file writing on the server, generic network timeout issues and what have you. Either way, you have written a longwinded post with no real value since you haven't bothered to provide any proper technical info, most notably about the alleged server. Either way, the only way you can "fix" it is by straightening out your server and network configuration, not some magic switch in Adobe's software.
    Mylenium

  • Trying to drag pdf files i have and combine them into one pdf file in the account i just purchased with Adobe. when i drag a pdf file over Adobe doesn't accept it. says it can not convert this type of file. but it is an Adobe file. Do I need to change it?

    Trying to drag pdf files i have and combine them into one pdf file in the account i just purchased with Adobe. when i drag a pdf file over Adobe doesn't accept it. says it can not convert this type of file. but it is an Adobe file. Do I need to change it in some other form befor dragging it?

    Hello djensen1x,
    Could you please let me know what version of Acrobat are you using.
    Also, tell me your workflow of combining those PDF files?
    Please share the screenshot of the error message that you get.
    Hope to get your response.
    Regards,
    Anubha

  • Error while converting class file to exp and jca file

    error while converting *.class file to *.exp and *.jca file
    =====================================================================================================================
    linux-y60u:/home/admin/java_card_kit-2_2_1/samples/src # converter -exportpath "/home/admin/java_card_kit-2_2_1/lib/" com/sun/javacard/samples/HelloWorld 0x00:0x01:0x02:0x03:0x04:0x05:0x06:0x07:0x0b 1.0 -v -applet 0x00:0x01:0x02:0x03:0x04:0x05:0x06:0x07:0x0b:0x01 Identity
    Java Card 2.2.1 Class File Converter, Version 1.3
    Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
    parsing /home/admin/java_card_kit-2_2_1/samples/src/com/sun/javacard/samples/HelloWorld/HelloWorld.class
    parsing /home/admin/java_card_kit-2_2_1/samples/src/com/sun/javacard/samples/HelloWorld/Identity.class
    error: com.sun.javacard.samples.HelloWorld.HelloWorld: unsupported class file format of version 50.0.
    error: com.sun.javacard.samples.HelloWorld.Identity: unsupported class file format of version 50.0.
    conversion completed with 2 errors and 0 warnings.
    =====================================================================================================================

    i compile a file javacard use this command:
    ===
    javac -source 1.3 -target 1.1 -g -classpath ./classes:../lib/api.jar:../lib/installer.jar src/com/sun/javacard/samples/Identity/Identity.java
    ===
    and try to convert this class use this command
    ===
    /home/xnuxerx/admin/java_card_kit-2_2_1/bin/converter -exportpath "/home/xnuxerx/admin/java_card_kit-2_2_1/lib/" com/sun/javacard/samples/Identity 0x00:0x01:0x02:0x03:0x04:0x05:0x06:0x07:0x0b 1.0 -v -applet 0x00:0x01:0x02:0x03:0x04:0x05:0x06:0x07:0x0b:0x01 Identity
    ===
    result convert:
    ===
    Java Card 2.2.1 Class File Converter, Version 1.3
    Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
    parsing /home/xnuxerx/admin/java_card_kit-2_2_1/samples/classes/com/sun/javacard/samples/Identity/Identity.class
    converting com.sun.javacard.samples.Identity.Identity
    error: export file framework.exp of package javacard.framework not found.
    conversion completed with 1 errors and 0 warnings.
    ===
    why ??
    please your comment for this problem.
    thank 4 all.

  • When I attempt to open a PDF file I saved from a website, I get the message "There was an error opening this document. The file is damaged and could not be repaired." Is there any way to correct this problem?

    When I attempt to open a PDF file I saved from a website using Safari, I get the message "There was an error opening this document. The file is damaged and could not be repaired." When I save the same PDF file using FireFox it opens up immediately. Is there any way to correct this problem with Safari?

    Back up all data.
    Triple-click the line of text below to select it, the copy the selected text to the Clipboard (command-C):
    /Library/Internet Plug-ins
    In the Finder, select
    Go ▹ Go to Folder
    from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
    From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
    The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present.
    If you still have the issue, repeat with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again.

  • Can't open CR2 files in photoshop and camera raw

    This weekend I rented a Canon 5D Mark iii. I have downloaded the files and all of the thumbnails in camera raw say CR2 and when I try to open Photoshop does not recognize this product.
    I have:
    Photoshop CS4
    Camera Raw CS4
    Canon 5D Mark ii
    I have checked my updates folder and all my updates are current. Do I need to upgrade to CS5 or is there a way around this?

    Hi I recently had a problem opening CR2 files in PHotoshop cs4. I had to reinstall into a new computer, so obviously it installed the basic programme and not the updates.
    After trying everything, even calling the help desk, there was apparently nothing that can be donw as they no longer support cs4.
    I kept trying and found a you tube video, which i cant find again to add the link but i followed the link and with what I did earlier I can now open CR2 files in my photoshop cs4
    I found the relevany update that I needed to install and downloaded it, camera raw 5.2 ( Adobe - Adobe Camera Raw and DNG Converter : For Windows : Camera Raw 5.2 update )  this is the one for the Canon 5d Mk2
    After downloading it would not update the progeramme so I was in the same possition, but i noticed the files were there and i just needed to put them in the right place in photoshop so carried on looking for were to put the Plus In.
    This led me to the video.
    To the point.
    Download the update and save to a location where you will remember.
    open Adobe photoshop and go to "edit"
    Them " Preferences "
    then "General "
    Then " Plus-Ins"
    At the top you will see " Add Plug-Ins Folder " Check this box then navigate to the "win64" ( this is because mine is a windows 64 bit computer and the download is specific ) and Choose it.
    Shut down photo shop and try to open a raw.
    Bridge doesnt work for some reason but im going to keep looking.
    Hope this works for you as well.

  • The file is damaged and it can not be repaired (PDF Printing in Z-program)

    I am opening this thread on behalf of my colleague Merja regarding a problem while trying to print using the Integrated ITS 6.40.
    The problem happens when using webgui directly. Support Package level is 21 and kernel 640 patch 196. Note 771683 regarding printer with access
    method 'F' and device type 'PDF1' is already in place. 'Output immediately' opens the preview. Error still exists when using "print preview" button.
    The issue occurs when trying to review the Employment Contract within the portal UI. The actual print is finished correctly but the "Print Review" function returns HTTP 500 error, "The file is damaged and it can not be repaired".
    When we perform the same activity in system R/3 within the transaction SE38, with our Z-program everything works correctly and no problems occur.
    Could you please help solving this issue?
    Thanks and regards,
    Merja

    Not sure if the flollowing will be of use, but worth a try?…
    Try changing the .ai to .eps or .pdf to see if anything happens to see if it makes a difference to importing or exporting as a pdf?
    If you have Indesign, try importing the file into Indesign then saving that file as a pdf or/and export as a Indesign eps file.
    Sorry I cannot be of any more assistance.
    Good luck!

  • Adobe Creative Cloud - How To Share Files With Clients and Colleagues | Creative Suite Podcast: Designers | Adobe TV

    In this episode of the Adobe Creative Suite Podcast, Terry White shows how to share Photoshop, Illustrator and InDesign Files with clients and colleagues and all they'll need is a browser to comment and see your Photoshop Layers.
    http://adobe.ly/10ZjpE4

    Terry,
    I guess I miss something. How can I share a folder of photos? When I return from a shoot, I select 20 of the pictures and need to share them with my client to pick up the favorites. Am I supposed to copy and past an URL for each image separately?
    Sometimes I also work with a colleague, I need to share my favorites with him. Same issue.
    We have tried Adobe Cloud, and then went for Dropbox. There we can share a folder and he can put even his pictures in it as well. That's what I call collaboration. And it is free (unlike Adobe Cloud). If you have some word in Adobe, please tell them to either drop it and make a deal with services like Dropbox, or make it properly.
    Thanks.
    Vaclav

  • When I download firefox, using recommended setting, or my own, all the sub files/folders like plugins, modules, updater end up on the desktop as well as in the file location. And when I try to put them into the file location, they don't. And when I delete

    When I download firefox, using recommended setting, or my own, all the sub files/folders like plugins, modules, updater end up on the desktop as well as in the file location. And when I try to put them into the file location, they don't. And when I delete them, FireFox won't open. I tried deleting FireFox and reinstalling it multiple times, and a message pops up sometimes that says FireFox may not have installed correctly, so I follow the steps, but all the extra icons on my desktop don't go away. This has happened every time I have downloaded FireFox. The browser itself works, but I need to know how to get rid of these icons, but still be able to use FireFox. This is on a new computer, with Windows 7.
    == I downloaded FireFox. ==
    == User Agent ==
    Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6

    Managed to solve this myself. Just went to properties > hidden.

  • How to change the default password file's name and path when the database created?

    how to change the default password file's name and path when the database created?
    null

    Usage: orapwd file=<fname> password=<password> entries=<users>
    where
    file - name of password file (mand),
    password - password for SYS and INTERNAL (mand),
    entries - maximum number of distinct DBA and OPERs (opt),
    There are no spaces around the equal-to (=) character.

  • I'm running snow leopard. The try to open any .mov file in Quicktime, and I get an error message that says, "The document xyz.mov could not be opened. The movie is not in a format that Quicktime player understands. I'm a recent upgrade to Snow Leopard.

    I'm running snow leopard. The try to open any .mov file in Quicktime, and I get an error message that says, "The document xyz.mov could not be opened. The movie is not in a format that Quicktime player understands. I'm a recent upgrade to Snow Leopard.
    Help!
    Thanks, Mark

    Unfortunately, the error message gives no details about what codec might be missing or what it needs.
    If the file can't be opened in QT, it only means you cannot use the QT "Inspector" window to check what compression formats were used to create the file. It does not mean you can't use the Finder "Information" window to check on the compression formats or use a third party media information window (e.g., like VLC which will open many compression formats not supported natively by QT) to determine what kind of data is included in the MOV wrapper. If the file cannot be opened in any app, it is usually a good sign that the file itself is corrupted.
    It's a stupid error message. Apple should do better than that.
    Error trapping is quite extensive but there are still many areas which require human oversight. The message is telling you that either the container has a problem (e.g., not properly terminated, non-standard, or corrupted) or that one or more of the compression formats used is not supported by your current codec component configuration or that the data was encoded using non-standard settings or preferences not supported by QT or that the fourCC code does not match the data contained in the file or that there are timecode inconsistencies, etc., etc., etc. In short there are a near infinite number of possible problems for which it would be very difficult/nearly impossible to program error trapping depending on your sourcing of content and how you process it before it reaches the player app. Think of it like trying to play a BD disc in an DVD player.
    I'll call Apple support when I get a chance.
    Chances are good that they will end up sending you back here. In any case, it is often a good idea to post a sample file for examination by other QT users. At the very least, they should be able to tell you if the sample file will play on other systems which would indicate whether or not the file itself is bad and under the best of circumstances whould allow them to examing the file in detail for various common problems.

  • "The file is damaged and could not be repaired" error when trying to open a PDF in Reader

    A few of our employess (only 3 out of over 100 so far) have been getting the error, "The file is damaged and could not be repaired" when trying to open some PDFs. Other people are able to open the same PDF files with no error. It's happening on about 10% of the time. I've read a bunch of threads here with this isue and tried some suggested fixes and nothing has resolved the issue. Here is what I have found works and does not work and the info on their computers:
    Computers:
    1 Dell Vostro desktop running WIndows 7
    1 Toshiba Satellite C55 runnign Windows 8
    1 Samsung ATIV Book 4 running Windows 8
    All using Adobe Reader XI but we did uninstall that version and tried previous versions and still got the error.
    Did Not Work:
    As suggested by the company that we use online for claims adjustments where this error is occuring, we tried using a different PDF creator since the files were created using a free PDF creator by the employees. PDF995 and PDFcreator (pdfforge) did not resolve the issue. I then created the PDFs with my Adobe Acrobat, uploaded from my computer to the online program, and that did not resolve the issue.
    Saving the file to hard drive and then opening in Adobe did not work.
    Turning off Protected Mode and Enhanced Security did not work.
    Compatibility View settings enabled in Internet Explorer 10 did not resolve the issue. The previously mentioned claims adjustment software company we use online was code for IE so is not fully compatible with other browsers.
    That being said I did try to open the PDF files in Chrome and it also did not work. Same error message.
    Does work:
    I download the file they cannot open onto my hard drive, open in Adobe Acrobat, Save as a pdf, then email it to them and they can open it via email attachment.
    If they close the error and continue trying to open the file over and over sometimes it will eventually open.
    Is there a setting in Windows that is preventing them from opening a small % of files some of the time? Thanks in advance for any help!
    James

    If anyone is reading this still looking for what caused the issue and how to fix it here is what I discovered.
    The antivirus program our company uses, Bitdefender Antivirus Plus, was causing some of the PDF files not to open. After troubleshooting the different modules and settings the culprit was..
    Scan SSL in Privacy Control Settings. Turning it OFF solved the problem and all the PDF files that previously would not open now open just fine. This issue has been sent to Bitdefender for them to review. If you use a different antivirus program and are having this issue try locating the Scan SSL setting and see if turning it off solves the problem.

  • With OSX10.7.5 and Adobe Reader 11.0.02 when I try to open a PDF downloaded from the web I get 'There was an error opening this document. This file is damaged and could not be repaired. Preview will not open either. Older PDFs OK.

    I am running OS X 10.7.5 and Adobe Reader 11.0.02. In the last few days I have been unable to open PDF's downloaded from the web. Reader gives the error message 'There was an error opening this document. The file is damaged and could not be repaired'. Removing Reader and trying to use Preview to open these files give the error 'Preview cannot open this file. It may be damaged or use a file format that Preview doesn't recognise' (or something like that). Downloading the same files with Reader removed from my Mac Preview opens the files OK.
    I was recently prompted to update Adobe software but did not note exactly what the update was nor when it was done.
    Reader and Preview will both open PDFs I downloaded a week ago. Reader will also open files downloaded on another Mac running OS X 10.0.0 and copied to my Mac. Any ideas?

    Back up all data.
    Triple-click the line of text below to select it, the copy the selected text to the Clipboard (command-C):
    /Library/Internet Plug-ins
    In the Finder, select
    Go ▹ Go to Folder
    from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
    From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
    The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present.
    If you still have the issue, repeat with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again.

  • I keep getting the message, "the file is damaged and could not be repaired"

    I have a newer Gateway PC equipped with Windows Vista Ultimate, and recently downloaded the free Adobe Reader 8.1.1 version to it.
    I'm not very computer literate, so I'm not sure which terminology to use all the time...sorry.
    When I attempt to open (view, read, download?) a pdf file, it starts the download process, showing the progress at the bottom of the page....for example, it might say, "downloading (16.2kb out of 543.5kb)"
    Usually, about a minute or so into the download, the word "downloading" changes to "downloaded", the action stops, and shortly after (on the window with the gray Adobe Reader background), a smaller message window pops up, declaring, "the file is damaged and could not be repaired".
    A friend suggested that there was probably a problem with the original downloading of Reader and recommended that I completely remove it from my system, then re-install it. Reluctantly, with a very slow dial-up connection network, I did as he suggested, then painfully sat through about a two-hour download AGAIN of Reader 8.1.1
    After the download was completed again, I successfully opened a few of the pdf files which I was previously having the problems with. Problem solved??? NOT QUITE!!! After about three or four successful file downloads (openings/readings of the files), it again started to do the same thing, where it would not complete the downloading/opening process and again leaving the message, "the file is damaged and could not be repaired."
    I am very confident that the files are not the problem, as many of my friends have viewed/opened those same pdf files repeatedly with no issues, BUT WHAT IS CAUSING THIS??? As I said before, I'm not very computer savvy as it is, and adding the newer Windows Vista Ultimate OS probably hasn't helped any.
    1. Is the problem with Windows Vista?
    2. Is the problem with Adobe Reader 8.1.1 (or the downloading of it)?
    3. Is the problem related to the security settings of my computer?
    4. Is the problem likely virus related (I use the purchased McAfee protection)?
    I just don't know where or how to start looking for the solution, other than thru this forum, and I simply can't afford the time to remove and re-install Adobe Reader 8.1.1 each time I need the use of my computer.
    Any assistance would be greatly appreciated, and you can e-mail me with suggestions to [email protected], or else call me on my cell
    THANK YOU,
    Don Maycumber
    Republic, WA
    509-570-8114 Verizon mobile

    I'm having the same problem but with high speed access.
    Anyone know the answer?
    ~Chris

Maybe you are looking for