Writing the hashtable content (both keys and values) into a text file

Hello,
I have a hashtable which have some keys and respective values in it. Now I want to write all thoses content into a text or log file. Can anyone please tell me how to write it.
thanks,
chaitanya

Properties is a subclass of Hashtable. It'll probably work just fine as a drop-in replacement.
Otherwise...if all keys and values are text, then loop through the Entry objects in the Map in question (Hashtable is a Map, and you probably shouldn't be using Hashtable anyway), or loop through the keys and grab the corresponding value for the keys. Read the API docs for java.util.Map. It's pretty straightforward.

Similar Messages

  • How to extract the Html content of a UI Map into a text file or html file?

    Hi,
    Is there any possibility in OUAF or Java or from the Database, to retrieve the Html Content of a given a UI Map ?
    If UI Map name is the input, then it should fetch the entire html portion of it into a text file. How to acheive this?
    This needs to be done programatically either by writing some Java code or some SQL at the DB level?
    Edited by: OATS Explorer on Dec 29, 2012 9:10 AM

    F1_MAP.HTML_DEFN would give the html contents and F1_SCHEMA.SCHEMA_DEFN would give you the UI Map's Schema.
    SELECT map.map_cd
      , map.html_defn
      , sch.schema_defn
    FROM f1_map map
      , f1_schema sch
    WHERE map.map_cd = sch.schema_name
    AND sch.schema_type_flg = 'F1MP'

  • Wirte the content of an internal table into a text file

    Hello Experts,
    how can I wirte the content of an internal table into a text file and putit on my local
    desktop ?
    Regards
    ertas

    Hi,
      You can use the FM GUI_DOWNLOAD for this purpose.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                    =
        FILENAME                        = 'c:\testmmv.txt'
      FILETYPE                        = 'ASC'
      APPEND                          = ' '
      WRITE_FIELD_SEPARATOR           = ' '
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
      WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
      SHOW_TRANSFER_STATUS            = ABAP_TRUE
    IMPORTING
      FILELENGTH                      =
      TABLES
        DATA_TAB                        = LT_STR
      FIELDNAMES                      = 
    EXCEPTIONS
       FILE_WRITE_ERROR                = 1
       NO_BATCH                        = 2
       GUI_REFUSE_FILETRANSFER         = 3
       INVALID_TYPE                    = 4
       NO_AUTHORITY                    = 5
       UNKNOWN_ERROR                   = 6
       HEADER_NOT_ALLOWED              = 7
       SEPARATOR_NOT_ALLOWED           = 8
       FILESIZE_NOT_ALLOWED            = 9
       HEADER_TOO_LONG                 = 10
       DP_ERROR_CREATE                 = 11
       DP_ERROR_SEND                   = 12
       DP_ERROR_WRITE                  = 13
       UNKNOWN_DP_ERROR                = 14
       ACCESS_DENIED                   = 15
       DP_OUT_OF_MEMORY                = 16
       DISK_FULL                       = 17
       DP_TIMEOUT                      = 18
       FILE_NOT_FOUND                  = 19
       DATAPROVIDER_EXCEPTION          = 20
       CONTROL_FLUSH_ERROR             = 21
       OTHERS                          = 22
    IF SY-SUBRC <> 0.
    Implement suitable error handling here
    ENDIF.
    With regards,
    Vamsi

  • Binary Tree Implementations - why both key and value?

    Hi there!
    I'm sitting here implementing a binary tree, and I was just wondering why most of the binary tree examples encapsulate both a key AND a value in their nodes. Wouldn't it be sufficient to just store comparable objects in the nodes (or provide a comparator for alternative ordering)?
    Thanks again, Oliver
    P.S.:Any suggestions on good books (free E-Books preferred :-)) on ADTs and algorithms? I'm reading 'Data Structures And Algorithms In Java' by Robert Lafore and not very happy with it (the examples are just plain awful).

    Trollhorn wrote:
    Hi there!
    I'm sitting here implementing a binary tree, and I was just wondering why most of the binary tree examples encapsulate both a key AND a value in their nodes. Wouldn't it be sufficient to just store comparable objects in the nodes (or provide a comparator for alternative ordering)?Yes.
    Thanks again, Oliver
    P.S.:Any suggestions on good books (free E-Books preferred :-)) on ADTs and algorithms? I'm reading 'Data Structures And Algorithms In Java' by Robert Lafore and not very happy with it (the examples are just plain awful).As online resources:
    [http://www.cs.princeton.edu/introcs/44st/]
    [http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-006Spring-2008/CourseHome/index.htm]
    I don't know of any eBooks on the subject, but I can recommend an excellent hard copy book:
    Introduction To Algorithms, by Cormen et al. [http://highered.mcgraw-hill.com/sites/0070131511/information_center_view0/]

  • Error message display both key and value

    Hi,
    I've an alt key check & if the validation fails then the error message pops-up and displays :
    Error
    JBO-SUB_TYPE_CODE_ALREADY_EXIST: The sub type code already exists.
    I'm not sure why is it displaying the key (JBO-SUB_TYPE_CODE_ALREADY_EXIST:) part also in the message.
    Can someone tell me how to suppress the key part in the error message and just display the message (The sub type code already exists.).
    Thanks,
    -Gaurav

    Hi,
    If you want to avoid the roundtrip to the database you can also create a uniqueKey validator in the Entity Object
    were the AltKey exists. In the failure handling of the validator set the message that you want to be displayed.
    You can see an example of this here: http://www.gabrielsideras.com/2010/09/28/adf-unique-key-validation/
    Gabriel

  • [SOLVED] Thunar sees both '.doc' and '.txt' as plain text files...

    Hello,
    I'm using Thunar as my file manager. However, it sees both '.doc' and '.txt' files as "plain text files".
    This means that I can't make the .doc files open with OpenOffice and the .txt files open with a plaintext editor, because whenever I change the program association of one, the other changes.
    How to fix that? (looks like a MIME-type issue).
    Thanks.
    Last edited by Renan Birck (2009-08-14 15:57:05)

    DaVince wrote:Open /usr/share/mime/globs and /usr/share/mime/globs2, find the lines that assign *.doc to the plaintext mime type, and remove them. Restart Thunar, problem solved.
    Finally it works. Thanks!

  • Why does HashMap.java  use transient  for  the collection of key and value?

    I just took a look at source code of HashMap.java.
    It uses the variable "table" to store the keys and values.
    This vairalbe is transient, but any hashmap can be serialized and deserialized.
    Could you please help me clarify how it could happen that the transient variable can be serialized?

    The 'table' might be transient, but its content, or current data content of the map, shoud be somehow saved/restored in the serializing/deserializing code of the HashMap.

  • My email (sign-in) and password for iTunes is different than my email (sign-in) and password for iCloud. How do I change my sign in and password so they are the same for both iTunes and iCloud without losing my iTunes content?

    My email (sign-in) and password for iTunes is different  than my email (sign-in) and password for iCloud. How do I change my sign in and password so they are the same for both iTunes and iCloud without losing my iTunes content?

    Hey Lakedrive442,
    It sounds like you have changed your Apple ID which you use with iTunes.  If so there are several places you may need to update it as outlined in this article.
    Apple ID: What to do after you change your Apple ID - Apple Support
    Of course some might not apply, but many might.
    Thank you for thinking of Apple Support Communities for your support needs.
    Nubz

  • How to populate both key and text in drop down list in dialog prog screen

    Hi, Can anyone please advice how to display both key and text in the drop down list in dialog prog screen. I tried with below code. keys and texts are getting populated in values table but only text is appearing when click on drop down. need to display both key and text in the drop down. Thanks in advance.
    TABLES: ZRPP_MODELS, ZRPP_FFLSTRATEGY.
    TYPE-POOLS : VRM.
    DATA : field_id TYPE VRM_ID ,
           values   TYPE VRM_VALUES,
           value    LIKE LINE OF values.
    FORM fill_model_list .
      select MODEL MODEL_DESC from ZRPP_MODELS into value.
        APPEND value TO VALUES.
      endselect.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id     = 'ZRPP_MODELS-MODEL'
          values = values.
    ENDFORM.

    You need to concatenate KEY & VALUES
      wa_values-key = '1'.
      wa_values-text = '1 - One'.
      append wa_values to i_values.
      wa_values-key = '2'.
      wa_values-text = '2 - Two'.
      append wa_values to i_values.
      wa_values-key = '3'.
      wa_values-text = '3 - Three'.
      append wa_values to i_values.
      call function 'VRM_SET_VALUES'
        exporting
          id              = 'LIST_BOX'
          values          = i_values
        exceptions
          id_illegal_name = 1
          others          = 2.

  • Iterate thru a HashMap() to view its keys and values

    I need to iterate over the hashmap to view its keys and values
    but the hashmap in 1.5 doesnt return itearor
    is there another way to view the key and value in the hashMap
    HashMap<String, Integer> colMap = new HashMap<String, Integer>();
    String[] array = { "Internal", "Transfer ", "Settle",  };
      List<String> colnames = Arrays.asList(array);
      for (int i = 0; i < cols; i++) {
        if (colnames.contains(headers.get(i))) {
                    colMap.put(headers.get(i), new Integer(i));
      // I need to iterate over this map to get key and values
      // The code below doesnt give me the key and values
         for (Iterator iter = colMap.iterator(); iter.hasNext();)
           Map.Entry entry = (Map.Entry)iter.next();
           String key = (String)entry.getKey();
           String value = (String)entry.getValue();
     

    Maps provide methods called keySet(), values() and entrySet(). Each of those returns a Collection (Set/Collection/Set respectively) that represents a view on the Map. You can get those and get a iterator of that objects.
    If you need both the key and the value in a loop, then you should use the entrySet method.

  • How to create the Business System both sender and receiver in SAP XI / PI

    Dear All
    kindly let me know how to create the Business System both sender and receiver in SAP XI / PI
    Regards
    Blue

    Hi,
      If by any chance you are not able to find these....
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/workingwithSystemLandscapeDirectory+%28SLD%29&
    http://help.sap.com/saphelp_nw04s/helpdata/en/24/8fa93e08503614e10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/f1/92b248db68409487661ff13239127d/content.htm
    Regds,
    Pinangshuk.

  • How to set PropertyBag Key and value at farm and sitecollection via PowerShell

    Hi,
    how could i create PropertyBag Key and value at farm and sitecollection via PowerShell?
    Best Regards
    Bog
    Developers Field Notes | www.bog1.de

    Hey, you can do it as follows 
    asnp *sh*
    $site = get-spsite "site url"
    $web = $site.openweb()
    $web.AllProperties["NEW KEY"] = "NEW VALUE"
    $web.update()
    $web.dispose()
    Your new custom property will be present in the web Property bag. 
    and you can access it by $web.AllProperties["New Key"] or simply $web.Properties["New Key"]
    get2pallav
    Please click "Propose As Answer" if this post solves your problem or "Vote As Helpful" if this post has been useful to you.

  • HashMap keys and values not staying consistent (my fault, but why?)

    Alright, after starting out for the very first time with HashMaps a few hours ago, I've gotten the hang of them decently I think. I am encountering a problem, though, when I try to get user-selected keys + values to display. My code is:
       public void useZone(String use)
           Object used = hm.get(use);
           System.out.print("\f");
           Set set = hm.entrySet();
           Iterator i = set.iterator();
           if (used != null){
               System.out.println("Time Zone Used:");
               Map.Entry thiszone = (Map.Entry)i.next();
               Object usedzone = thiszone.getValue(); //Get the value of the zones and assign them as Object usedzone
               Integer useval = (Integer) usedzone; //Assign the Object to an Integer value so we can use it
               difference = useval;
               if (useval > 0){ //Display the hour offset correctly
                   System.out.println(use + ": GMT +" + usedzone.toString());
               else if (useval == 0){
                   System.out.println(use + ": GMT");
               else if (useval < 0){
                   System.out.println(use + ": GMT " + usedzone.toString());
           else{
               System.out.println("Invalid zone name.");
           } //End if
           ClockDisplay.getZone(difference); //Send variable difference
      }What will happen is that the first time I will be fine...
    Say the HashMap keys and values are
    "Rome", "-2"
    "Chicago", "6"
    "New York", "5"
    "Paris", "-1"
    If I type "Rome" in when I execute this method, it gives me the correct output - "Rome: GMT -2"
    If I then re-run the method, as to display a different one, I get "Chicago: GMT -2"
    It's like the name the user inputs is updating, obviously, but the value of the HashMap that goes along with the user-input doesn't match up or something. My code is confusing myself after looking at it for nearly 10 hours, so I apologize that I had to post something so trivial here - I'm sure it's just a problem with my wordings....any help would be greatly appreciated.

    Hello,
    It's very possible I'm missing some things here, but I've attempted to review your code.
    Let me just define the specs of the code as I see them:
    Method useZone accepts String input, which is "supposed" to be the key to a hashmap.
    The timezone offsets are the value's in this hashmap.
    The value is of type Integer.
    If a key is properly selected, print out GMT + or - the offset?
    If I have this correct, consider the following implementation:
       public void useZone(String use) {
           Integer offset = (Integer)hm.get(use);
           System.out.print("\f");
           if (offset != null){
               System.out.println("Time Zone Used:");
               System.out.println(use + ": GMT +" + offset.toString());
           } else{
               System.out.println("Invalid zone name.");
           ClockDisplay.getZone(offset); //Send variable difference
      }I'd guess you're getting odd behavior because you're creating an iterator to iterate through the map, but then only calling i.next() once - HashMap doesn't guarantee insertion order, so the fact it worked once correctly is "random".
    Also, if you are using java 1.5 declare the map as follows:
    Map<String, Integer> hm = new HashMap<String, Integer>();And you can get rid of the casts. I would also suggest renaming the hashmap to something that describes what it holds, rather than it's object type. Maybe something like timeZoneMap - or offsetMap. I would also consider renaming "use" to something that describes the data it might hold, instead of something that describes the workflow.
    Variable naming is very difficult! I would suggest renaming all of your variables, but I think those are the only ones I kept!
    Edited by: Adam_Schaible on Nov 28, 2007 12:09 PM

  • I am trying to read my iMessages from my iPhone 4S on my iPad 2, but the messages do not show up on my iPad 2. I made sure that the receiving email address is the same on both devices and both are signed into my single Apple account.

    I am trying to read my iMessages from my iPhone 4S on my iPad 2, but the messages do not show up on my iPad 2. I made sure that the receiving email address is the same on both devices and both are signed into my single Apple account.

    Is it possible that the person who sent the message to your phone sent it to your phone # instead?  Try sending a message to your phone via the email address and see if it shows up on the iPad.

  • I accidenttly deleted my notes and the icloud cleared all the message from both ipad and iphone  ...How can i get it back?? If I can ??

    I accidenttly deleted my notes and the icloud cleared all the message from both ipad and iphone  ...How can i get it back?? If I can ??

    Your notes should be stored in your backup, so if you have backed up the iPad and that backup does contain those notes that you deleted, you can try restoring from your backup. If you haven't backed up the iPad since you created those notes, they are gone.
    If you backup with iCloud only, restoring from backup involves erasing the device and then going through the setup all over again and finally restoring from the iCloud backup. This article explains the process quite clearly.
    http://gigaom.com/apple/ios-101-set-up-and-restore-from-icloud-backup/
    If you backup with iTunes, connect the iPad to your computer, launch iTunes and right click on the device name on the left and select - Restore from Backup. But before you do that .... turn off auto sync in iTunes - without connecting the iPad - launch iTunes and go to Edit>Preferences>Devices and check the box at the bottom of that window in order to turn off auto sync.
    Email messages are not stored in your backups.

Maybe you are looking for

  • How to create Application Workspace with Jdeveloper 10g 1.3.2?

    Following the instructions in "Developing and Using ADF Faces Skins", I am trying to create an Application Workspace. The instruction says: "In JDeveloper, create a new Application workspace and name it - ADFFaces_skin_sample" I can not find the way

  • Setting? Clicking on color NEF files in Bridge change them to sepia/grayscale!

    What's wrong? When I download color NEF files into Bridge (CS3 and ACR 4.6) or Lightroom 2, a funny conversion happens without any prompting on my part.   In Bridge, if I click on the color thumbnail, the NEF thumbnail turns into a sepia/grayscale, a

  • BLS, extract parts of an XML

    Hi. I may have asked before, but can not find the answer anywhere. I have an XML which I want to extract parts of. It this possible an how? I want to get the part /ns1:GetProductionSchedule /ns2:GetProductionSchedule /ns2:DataArea /ns3:ProductionSche

  • "Unexpected Error" when I try to save as a PDF or export my form.

    I spent 3 days creating a complicated form in Forms Central (and I'm SO not happy about that). Now, when I try to export the form or save the form as a PDF, I get an unexpected error. I wasn't happy with this tool before, but now I'm ready to scream.

  • Dashboard level permission - not working?

    Hi, I have below Set up, created users via weblogic console (just created users only in console) and created custom roles in weblogic EM then assigned users to the below role, after that login to presentation administration catalog page and granted d