How to interact an input file with other methods in a class?

I have to write a class name FileDisplay with methods:
1. Constructor: take the name of a file as an argument
2. displayContents: display the entire contents of the file
when I tried to create a BufferedReader file variable, I have encountered an error about IOException. Then I tried to put this variable to the constructor. The problem didn't occur anymore but another problem has occured. The displayContents can not recognize the BufferedReader file variable because it was created in the block of constructor, not related to displayContents at all!
I wonder how I can solve this problem? Anyone has any idea? Thank you ./.

Well, I suppose your displayContents() method could allow the IOException to bubble up to its invoking method via throws.
I assume that method is the constructor which, in turn, will need to do the same thing.
Then, whatever method invokes that constructor will also need to do the same thing.
Not really good style.
Of course, if you haven't yet covered the throws clause, then, I think you're screwed.
It sounds like exception handling should have been discussed before this assignment.

Similar Messages

  • How I can combine pdf file with other pdf file

    How I can combine pdf file with other pdf file ?

    Or from Adobe Reader via https://createpdf.acrobat.com/

  • How should i share file with other devices such as nokia,blackberry and etc using bluetooth

    I want to share  files between other deivce such as nokia but couldnt, could u help me tell how can i share files with other devices???

    @AKRBTN: Thanks for the reply and info.
    That is a solution, but it really isn't viable.
    It is sad that apple refuses to support this.
    A simple example: Sitting somewhere with no signal and you want to share a file (photo) with your colleague or friend, who happens to be right next to you.
    Or even if there is signal and you don't want to be paying fees or data charges.
    Or you may be in a rehearsal studio and need to share that very important file and have no time to go outside and get signal and try to send the file, which then everyone else has to go outside and catch the signal and pay fees.
    Anyway, I see that this is a dead end with apple, so I guess I will be back to carrying 2 phones around again.
    Peace,
    SB

  • How to load unicode data files with fixed records lengths?

    Hi!
    To load unicode data files with fixed records lengths (in terms of charachters and not of bytes!) using SQL*Loader manually, I found two ways:
    Alternative 1: one record per row
    SQL*Loader control file example (without POSITION, since POSITION always refers to bytes!)<br>
    LOAD DATA
    CHARACTERSET UTF8
    LENGTH SEMANTICS CHAR
    INFILE unicode.dat
    INTO TABLE STG_UNICODE
    TRUNCATE
    A CHAR(2) ,
    B CHAR(6) ,
    C CHAR(2) ,
    D CHAR(1) ,
    E CHAR(4)
    ) Datafile:
    001111112234444
    01NormalDExZWEI
    02ÄÜÖßêÊûÛxöööö
    03ÄÜÖßêÊûÛxöööö
    04üüüüüüÖÄxµôÔµ Alternative2: variable length records
    LOAD DATA
    CHARACTERSET UTF8
    LENGTH SEMANTICS CHAR
    INFILE unicode_var.dat "VAR 4"
    INTO TABLE STG_UNICODE
    TRUNCATE
    A CHAR(2) ,
    B CHAR(6) ,
    C CHAR(2) ,
    D CHAR(1) ,
    E CHAR(4)
    ) Datafile:
    001501NormalDExZWEI002702ÄÜÖßêÊûÛxöööö002604üuüüüüÖÄxµôÔµ Problems
    Implementing these two alternatives in OWB, I encounter the following problems:
    * How to specify LENGTH SEMANTICS CHAR?
    * How to suppress the POSITION definition?
    * How to define a flat file with variable length and how to specify the number of bytes containing the length definition?
    Or is there another way that can be implemented using OWB?
    Any help is appreciated!
    Thanks,
    Carsten.

    Hi Carsten
    If you need to support the LENGTH SEMANTICS CHAR clause in an external table then one option is to use the unbound external table and capture the access parameters manually. To create an unbound external table you can skip the selection of a base file in the external table wizard. Then when the external table is edited you will get an Access Parameters tab where you can define the parameters. In 11gR2 the File to Oracle external table can also add this clause via an option.
    Cheers
    David

  • Sharing files with other members of my family on the wireless network

    I would like to share my files with other members of my family on the wireless network. Unfortunately, their pcs are MS Windows OS and connected in workgroup type while I am on Mac. I can access internet via the same wireless router but cannot see other members. Can someone advise How I can accomplish it. Thanks!

    I don't have personal experience with this, but I was reading this article earlier today, and it seems to address your situation. I think the solution is on page 2.
    http://bx.businessweek.com/microsoft-vs-apple/view?url=http%3A%2F%2Fwww.computer world.com%2Faction%2Farticle.do%3Fcommand%3DviewArticleBasic%26articleId%3D91315 58
    Hope this helps.

  • How do I share my playlists with other accounts/users on my Mac?

    How do I share my playlists with other accounts/users on my Mac?

    Hello,
    I have a similar question, which I posted 8perhaps inappropriately) in the Home Sharing discussion: https://discussions.apple.com/message/17405588#17405588
    The problem I have is that it simply doesn't work and the question I have is how you do not move the the iTunes Library file or the iTunes Library.xml file when they are actually in the folder you are told by the article to move in the first place.

  • How can I print a file with mixed page orientation in windows 8.1?

    I have a win 7 and a win 8.1 computer.  I have a file which contains both landscape and portrait pages.  The file prints correctly with the mixed orientation from the win 7 pc, but will only print with either landscape or portrait on the win 8.1 pc. 
    I am using Adobe reader XI on the win 7 pc and adobe touch on the win 8.1 pc

    ส่งจาก จดหมายของ Windows
    จาก: Pat Willener
    ส่งเมื่อ: จ. 5 มกราคม 2558 6:15
    ถึง: thang dinhvan
    How can I print a file with mixed page orientation in windows 8.1?
    reply from Pat Willener in Adobe Reader Touch for Windows 8 - View the full discussion 
    I have a win 7 and a win 8.1 computer.  I have a file which contains both landscape and portrait pages.  The file prints correctly with the mixed orientation from the win 7 pc, but will only print with either landscape or portrait on the win 8.1 pc. 
    I am using Adobe reader XI on the win 7 pc and adobe touch on the win 8.1 pc
    If the reply above answers your question, please take a moment to mark this answer as correct by visiting: https://forums.adobe.com/message/7064031#7064031 and clicking ‘Correct’ below the answer
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
    Please note that the Adobe Forums do not accept email attachments. If you want to embed an image in your message please visit the thread in the forum and click the camera icon: https://forums.adobe.com/message/7064031#7064031
    To unsubscribe from this thread, please visit the message page at , click "Following" at the top right, & "Stop Following"
    Start a new discussion in Adobe Reader Touch for Windows 8 by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to https://forums.adobe.com/thread/1516624.

  • In ABAP How to locate an Input file  from a Directory during run time

    I'm loading data from a flat file(text file) into SAP thru BDC programs. All my input files are present in Application server.How to locate an Input file in a directory during run time to process BDC programs programmatically. Are there any in-built functions?Provided me some sample code or any method of doing the same.

    Hello Murali,
    you should ask this question in the ABAP forum.
    Regards
    Gregor

  • There is no 'Save as' under the file menu.  How do I save a file with another name?

    Numbers help refers to the 'Save As' function in the File menu.  My version (latest) does not have a 'Save As' function.  How do I save a file with another name?

    Ross Millard wrote:
    Badunit. You have an original file and an edited file. Now you duplicate the edited file and save it with a different name. Now do you have to go and delete the changed file from which the duplicate had been made? And.... is the original still unchaned... still original?
    Ross,
    For the situation you describe, Apple has provided Duplicate and Revert. Use File > Duplicate to reach this menu:
    Regards,
    Jerry

  • How to create a pdf file with CS5

    Hello, I'm new to PhotoShop CS5 and haven't figured out yet (despite two hours of trying) how to create a pdf file with pictures and texts.  Can someone please help me with this ?  The "help" button in CS5 doesn't seem to cover this question.  Nor do the FAQs.
    Thank you very much.

    Save As... Photoshop PDF.

  • How to fix the .pdf file with error "invalid annotation object"

    how to fix the .pdf file with error "invalid annotation object"

    As long as the PDF opens, then just try saving it to a new file name. There may be a preflight script that would help troubleshoot the issue.

  • How to convert a pdf file with hand-written signature?

    How to convert a pdf file with hand-written signature?

    Hi Lotus1215,
    Once the document is signed we cannot edit that document, hence convertion is not possible
    Please see the article mentioned below
    http://forums.adobe.com/docs/DOC-1515
    Let me know if you have any other question.
    Regards,
    ~Pranav

  • How to create a csv file with NCS attributes?

    Hi
    i installed Cisco Prime NCS and trying to perform bulk update of device credentials with csv file.
    How to create a csv file with all required attributes?
    This is part of NCS online help talking about this topic:
    Bulk Update Devices—To update the device credentials in a bulk, select Bulk Update Devices from the Select a command drop-down list. The Bulk Update Devices page appears.You can choose a CSV file.
    Note        The CSV file contains a list of devices to be updated, one device per line. Each line is a comma separated list of device attributes. The first line describes the attributes included. The IP address attribute is mandatory.
    Bellow is test csv file i created but does not work:
    10.64.160.31,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    10.64.160.31,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    The error i am getting while importing this file:
    Missing mandatory field [ip_address] on header line:10.64.160.31,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    Assistance appreciated.

    It looks like the IP address field is incorrectly set.,
    It should be as follows
    {Device IP},{Device Subnet Mask}, etc etc
    so a practical example of the aboove could be (i dont know if this is completely correct after the IP address / Subnet Mask)
    10.64.160.31,255.255.255.0,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    below is a link to the documentation
    http://www.cisco.com/en/US/docs/wireless/ncs/1.0/configuration/guide/ctrlcfg.html#wp1840245
    HTH
    Darren

  • In Pages how do I save a file with another name

    In Pages how do I save a file with another name?

    I don't know if there is a less cumbersome way to do this (I'm still pretty new to Lion) but This is what I do - since "Save As" seems to be gone with Lion.
    I create a duplicate document - then click the red button to close the document - and a dialog box pops up and asks if you want to save the changes - I change the name in there and then save the file under the new name.
    You can also save the copy to the desktop - get info - and then change the name if the finder window.
    I copied this from the Pages help area. These help instructions were created pre-Lion I'm sure.
    Saving a Copy of a Document
    If you want to make a copy of your document—to create a backup copy or multiple versions, for example—you can save the document using a different name or location. (You can also automate saving a backup version, as Automatically Saving a Backup Version of a Document describes.)
    To save a copy of a document: 
    Choose File > Save As and specify a name and location.
    The document with the new name remains open. To work with the previous version, choose File > Open Recent and choose the previous version from the submenu.

  • How to configure the .ini file with applet

    hai
    i am using native methods in that methods they use some ip addresses. when i am using that native methods in applet run the applet using appletviewer tool it works fine but when i am open that applet using html page browser not configure that .ini file data .how to configure that .ini file with browser

    Hi Jay SenSharma,
    Thanks for your immediate response.
    I saw your URL links, But in your link give the recursive deployment using wlst. But my question is how to configure the oracle weblogic library files into Admin server & Managed Servers by using the wls.jar file through wlst script to create the new domain.
    But if create the new domain by using GUI mode then we manually give the admin server port number & managed servers port number and name.
    By default the library files are configured with the Admin server in GUI mode. But the Managed server the Library files are not configured with the Managed servers. Then we manually select all the library files to the corresponding managed servers. Then only the applications are deployed into the corresponding managed server.
    Regards,
    S.vinoth Babu

Maybe you are looking for

  • Nulls in Rowsets

    The issue with dataTables is well known - they currently don't handle fields with nulls in them gracefully. But it also appears there is an issue with standard rowSets - I have a panelGrid of textFields, and if one of my columns in the rowSet is null

  • Table for characteristics of a material

    hi all,         i have a requirement where in i need to add a customized field for characteristics of a material. where can i find the table for charactersitics of a material? i found the structure RCTAV but i could not find the table refering to thi

  • Exceptions in BPM

    I want to use Exceptions in BPM. In my block step I have created the Exceptions like Exceptions1 and Exceptions 2 etc. Now let us say if my Sender system is down then I want to use Exception1  or if the request is Bad then I want to use Exception2, h

  • Restoring Preview as default pdf viewer in Safari

    Hi, I mistakenly set Acrobat 7 as my default pdf viewer in Safari and now cannot change back to preview. I tried to click on a pdf doc and set preview as the default, but that doesn't work for pdf files that I need to download. I reset Safari, and no

  • How to fix IE script errors

    I am continuously getting script errors....sometimes after every key stroke I type (this just started happening about a week ago). I've gone to the Advanced tab of the Internet Properties and found that the "Disable script debugging" box is checked..