Help:FileWriter gives no output

Hi:
The following code gives no errors but also no output. I know that the encrypt method works because I am able to print the output to screen but I cannot get FileWriter to work.
Can someone help me with this problem?
Thanks.
import java.io.*;
class Monoalphabet
  public static void main(String args[])
  String keyword = args[0];
  char [] cypher;
  cypher = makeCypher(removeDups(keyword));     
  try
   FileReader f = new FileReader(args[1]);
   FileWriter f1 = new FileWriter(args[2]);
   encrypt(f,f1,cypher);
    catch(Exception e)
      System.out.println("Exception: " + e);
  public static void encrypt(FileReader reader,FileWriter writer, char[] cypher )
     int positionOfA = 'a';
     String outgoing = ""; 
     String temp = "";
     BufferedReader infile  = new BufferedReader(reader);
     try {
     while(( temp = infile.readLine()) != null)
          for (int k = 0; k < temp.length(); k++)
          char whatever = temp.charAt(k);
          char ch = cypher[(int)whatever -  positionOfA];
          String chs = new Character (ch).toString();
           outgoing = outgoing + chs;
           System.out.println(outgoing);    
         writer.write(outgoing);   
    catch(Exception e)
      System.out.println("Exception: " + e);
  public static String removeDups(String keyword)
  { String keep = "";
    keyword = keyword + "zyxwvutsrqponmlkjihgfedcba";
   for(int i = keyword.length()-1; i > -1 ; i--)
   if(i == keyword.indexOf(keyword.charAt(i)))
    keep = keyword.charAt(i)+ keep;
    return keep; 
  public static  char[] makeCypher(String remove)
      char Array [];
      Array = remove.toCharArray();
      return Array;

You may want to try flushing your FileWriter when you are done.
FileWriter f1 = null;
FileReader f = null;
try {
   f = new FileReader(args[1]);         
   f1 = new FileWriter(args[2]);  
   encrypt(f,f1,cypher);                    
} catch(Exception e) {     
  System.out.println("Exception: " + e);   
} finally {
  if (f1 != null) {
     try {
       f1.flush();
       f1.close();
     } catch (Exception e) {}
  if (f != null) {
     try {
       f.close();
     } catch (Exception e) {}

Similar Messages

  • Help in XML Report output

    Hi Experts,
    I have created the XML report which will generate the output in EXCEL format. I have used the template(rtf) to generate the output. I am facing the critical issue the output file (excel) is giving output with headings( ex: empno,ename,job..)even if there is no record count in the query.
    But some times it gives the empty file(excel) without the heading information if the record count is zero.
    Could anyone suggest me to solve this error.
    Any solution or link will be great help for me. Waiting for your valueable reply
    Thanks in Advance,
    Ravi.

    Hi,
    Please see if this thread helps.
    XML publisher output report in excel format
    Re: XML publisher output report in excel format
    Regards,
    Hussein

  • HP probook 6450b running windows 8 display port to HDMI doesn't give any output

    Hi,
    My laptop HP probook 6450b running windows 8, display port to HDMI doesn't give any output. I gave windows+P and tried selecting duplicate/extend but no output. I even tried to change the DP to HDMI converter and the HDMI cable as well but no luck. Any help would be much appreciated.

    Dear Customer,
    Welcome and Thank you for posting your query on HP Support Forum
    It looks like you are using the Display Port on the Notebook get HDMI Ouput for better Audio and Video
    We will surely assist you with this issue
    Firstly I would like to keep you informed that the Display Port supports resolutions up to 2560 x 1600, 30-bit color depth at 60 Hz, and full HD (1920 x 1080) monitors, 24-bit color depth at 120 Hz
    NOTE: Resolutions are dependent upon monitor capability, and resolution and color depth settings.
    Please use an HP DisplayPort to HDMI Adapter for this setup. Please make sure that you are using HP Cable/Converter with the Product Number BP937AA.
    1. Please let me know if you have additional graphics card installed on your Notebook
    2. You can try download and installing the latest BIOS Update for your Notebook from the HP Website
    3. Make sure VGA Port on the Notebook is not in use when you are testing the Display Port
    Hope this helps, for any further queries reply to the post and feel free to join us again
     **Click the KUDOS star on left to say Thanks**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.
    Thank You,
    K N R K
    Although I am an HP employee, I am speaking for myself and not for HP

  • Editable field with F4 help in alv tree output using cl_gui_alv_tree

    HI
    i need Editable field with F4 help in alv tree output using cl_gui_alv_tree
    Regards
    Naresh

    Hi Naresh,
    Pass the field catalog with the additional parameter (ls_fcat-edit = 'X'.).
    for F4 help if the data element have the search help it automatically will come. other wise include the additional parameter in the field catalog (ls_fcat-F4AVAILABL = 'X')
    Reward if found helpful.
    Regards,
    Boobalan Suburaj

  • Can anyone help me find the output option in Bridge CC?

    Can anyone help me find the output option in Bridge CC?

    http://helpx.adobe.com/bridge/kb/install-output-module-bridge-cc.html

  • Hello. i have a musical keyboard which is yamaha psr e433 and i want to connect it to my macbook pro. please help me give the name of the connector so i can use it for my band. thank you. your help is much appreciated.

    hello. i have a musical keyboard which is yamaha psr e433 and i want to connect it to my macbook pro. please help me give the name of the connector so i can use it for my band. thank you. your help is much appreciated.

    hello. i have a musical keyboard which is yamaha psr e433 and i want to connect it to my macbook pro. please help me give the name of the connector so i can use it for my band. thank you. your help is much appreciated.

  • VA05 & VA05N - Taking Long time to Give the Output.

    Dear All,
    VA05 & VA05N - Taking Long time to Give the Output for
                              Single date & Single Sales Office
    if I create Z-Program (VBAK) also taking Long time for Single date & Single Sales Office.
    Please Give some idea to Optimization the VA05 & VA05N.
    Please Give your Valuable solution.
    Thanks,
    Durai.V

    Dear Lakshmipathi,
       In my Previous client (ECC 5.0) VA05N Executing very fast for one month date for all sales office.
    They running SAP around 3 years, there data also huge but its giving fast output.
      But my current client ECC 5.0, here running SAP around 2.5 years, But here taking Long time to give
    the output for singe date & one Sales Office.
      But Billing details report VF05N Executing very fast.
    Thanks,
    Durai.V

  • Search help problem in ALV output for field TD24A-DISMM

    Hi Abap-Experts,
          I have one issue regarding simple ALV report.
          I need to display search-help for field DISMM.  I have used below code in ALV fieldcatalog.
          ts_fieldcat - tabname = 'TD24A'.
          ts_fieldcat - tabname = 'DISMM'.
          I have attached search-help for fields such as MATNR and WERKS too.
          The search-helps are getting displayed for MATNR as well as WERKS.
          But, the search-help is not gettting displayed for field DISMM(RP-TYPE) .
             The output displayed is done using Simple ALV.     
            Could anyone please help me and correct my code or logic i have used.

    Hi,
      I have changed code a bit...and used T438A table.
      CLEAR ts_fieldcat.
      ts_fieldcat-col_pos = '5'.
      ts_fieldcat-fieldname = 'DISMM'.
      ts_fieldcat-seltext_l = text-014.
      ts_fieldcat-outputlen =  2.
      ts_fieldcat-reptext_ddic  = ''.
      ts_fieldcat-ref_tabname   = 'T438A'.
      ts_fieldcat-ref_fieldname = 'DISMM'.
    ts_fieldcat-ddic_outputlen = '2'.
      ts_fieldcat-input         = 'X'.
      APPEND ts_fieldcat TO gt_fieldcat.
    still it is not showing me the F4 help in simplae ALV output..
    kindly help me

  • Help required in smartform output medium

    Hi All!
    I have a requirement where in the smart form, may be either:
    printed,
    saved as a pdf,
    sent as a fax,
    sent as an e-mail.
    we want all the logics to be in the print program based on any criteria.
    Is it possible to include all such logic in the same print program, and if so how can we choose the output medium, at the runtime i meant based on what criteria, the program is going to give the output.
    Thank in advance!!!
    Ashok
    Assured reward points.

    Hi,
    This is possible.
    You have to provide controls in your driver program and accordingly call the FM for either print, email or FAX on user choice.
    1. For Printing you have to directly call the smartform in your program.
    2. For Pdf - printing smartform
    3. For email/Fax -  How to send smartform as an email or fax
    Re: Smartforms to PDF
    Regards,
    Amit

  • My hard drive is damaged. I'm using disk utility; can I safely use CHECKSUM? will it help or give me info?

    my hard drive is damaged. I'm using disk utility; can I safely use CHECKSUM? will it help or give me info?

    Repair the Hard Drive and Permissions
    Boot from your Snow Leopard Installer disc. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Utilities menu. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the installer.
    If DU reports errors it cannot fix, then you will need Disk Warrior and/or Tech Tool Pro to repair the drive. If you don't have either of them or if neither of them can fix the drive, then you will need to reformat the drive and reinstall OS X.

  • Accessing Thunderbird help, Firefox gives the message "Unable to connected to datebase! Too many connectors."

    When I access Thunderbird Help, Firefox give the following message: "Unable to connect to database! Too many connectors." Other Thunderbird Help selections work OK.

    Sorry, the Mozilla Messaging forum isn't associated with this Firefox support forum. Sounds like that forum is very busy or is having server problems. All I can say is to try it later when it may not as busy, or a server problem is corrected.
    Or you could try the Thunderbird support forum over here. <br />
    http://forums.mozillazine.org/viewforum.php?f=39

  • Printed Purchase Order Report gives no output

    hello,
    The standard report "Printed Purchase Order Report(Landscape)" gives a a zero size output file for a certain po . Although i have checked the tables PO_HEADERS_ALL and PO_LINES_ALL and that purchase order has all the data entered in the tables above.
    what can the problem possibbly be and how can i fix it?
    please help...

    hello,
    as an update i found that the specified purchase orders has 9 lines entered and in PO_LINES_ALL only 5 are there !!!

  • Why saving as transparenct Gif in photoshop gives bad output

    hi the problem i am facing from long time is ..when i save as or even save for web my image to get the transparent image the output in IE browser gives very bad.. it gives broken edges even if i save in maximum quality . kindly help me here or email me at [email protected]

    Boy, did you come to the wrong place...this is the Lightroom Feature Request forum...nothing to do with Photoshop (well directly anyway). You'll need to wander down the hall...

  • F4 help to give desktop path for retrieving file name

    Hi Guys,
    I want a big help from u people, I worked on module pool programming and in that i had written some BDC also in that. Now my concern is i need to give F4 help path for the user to goto Desktop and pick the file from his PC.He will goto transaction and then only he can run the Report.
    Now i had tried this
    at selection-screen on value-request for p_filename.
    v_mask = ',Tab Delimited (.txt),.txt.'.
    CALL FUNCTION 'WS_FILENAME_GET'
      EXPORTING
        DEF_FILENAME     = ' '
        DEF_PATH         = ' '
        MASK             = v_mask
        TITLE            = ' '
      IMPORTING
        FILENAME         = p_filename
      EXCEPTIONS
        INV_WINSYS       = 1
        NO_BATCH         = 2
        SELECTION_CANCEL = 3
        SELECTION_ERROR  = 4
        OTHERS           = 5.
    but in at selection screen i need to give parameters or select-options... which is not there as u know bcoz its a module pool programming.....
    Can u pls help me out its urgent!!!!!!!!
    Rewards will be definite....

    Hi Abdul,
    Refer demo program DEMO_DYNPRO_F4_HELP_MODULE in SE38.
    Check Flow Logic by double clicking on the screen 100.
    PROCESS BEFORE OUTPUT.
      MODULE INIT.
    PROCESS AFTER INPUT.
      MODULE CANCEL AT EXIT-COMMAND.
    PROCESS ON VALUE-REQUEST.
      FIELD CARRIER MODULE VALUE_CARRIER.
      FIELD CONNECTION MODULE VALUE_CONNECTION.
    <b>Reward points if it helps.</b>
    Regards,
    Amit Mishra
    Message was edited by: Amit Mishra

  • Help to catch the output of a Transaction

    Hi,
    I have this issue and need help, I have a program lets say "ZPROGRAM", this programs calls a RFC "ZFUNC" this function must be able to send the parameters to execute a SAP standard transaction for example MB51, the function must send the plant number, storage location, and material number, then this RFC must catch the output of the report into an internal table so that i can work with the output in "ZPROGRAM", in other words what I see on screen as result of MB51 I need it in an internal table so that I can manupulate the data.
    I hope someone could tell me how to accomplish this.
    Thanks in advice.

    Hi,
       Pls try
        DATA list_tab TYPE TABLE OF abaplist.
        DATA vlist  LIKE  table of LISTZEILE WITH HEADER LINE.
        submit RM07DOCS
          with XXX
          EXPORTING LIST TO MEMORY
          and return .
          CALL FUNCTION 'LIST_FROM_MEMORY'
            TABLES
              listobject = list_tab
            EXCEPTIONS
              not_found  = 1
              OTHERS     = 2.
       CALL FUNCTION 'LIST_TO_ASCI'
          EXPORTING
            list_index         = -1
          TABLES
            listasci           = vlist
            listobject         =list_tab
          EXCEPTIONS
            empty_list         = 1
            list_index_invalid = 2
            OTHERS             = 3.
    Regards,
    Pole
    Edited by: Pole li on Jul 17, 2008 3:57 AM

Maybe you are looking for

  • Custom PSE5 actions not alphabetical when displayed in the pallette.

    I’m not getting much input (1 response) on the WINE forums for this so I thought I’d try here on the Arch forums.  The PC having issues is currently running Arch 2.6.38 x86_64 version, and the Wine version is 1.3.17.  I’d just updated the system befo

  • Account determination error for EK02

    Hi, I am using EK02 for unit costing in quotation used specially for PS. I have assigned EK02 in the quotation doc type and have added the same to the pricing procedure (marked it manual & ststistical) and assigned it SubTotal-B. It is working perfec

  • What is best app for resizing pictures

    I am looking for an app to resize the photos I download into Iphoto or other places.  Could someone recommend what is best and preferably free. Thank Bruce

  • Connection manager

    Hello, I'm trying to set a test envirinment to learn Oracle Connection Manager. I've read appropriate chapters in Net documentation and a forum thread: Re: Configuration of Connection Manager But there are still things that I can't work on. I have tw

  • Java Newbie Dev Kit

    I'm looking for a recommendation on a Java SDK kit that isn't an 80 meg download like Sun's, nor obsolete like VJ++ (which I have). I just want to learn to do Java programming for the web, as an alternative to PHP, which I am currently using. Can any