How to read the contens of an ini-File

How can I read the contens of an ini-File?

Depends on what you have in the file - ini file with or without sections.
Without sections: you may be able to read it as a property file.
With sections: You'll have to implement a class to read and parse the file, and a class to hold the parsed results.
If you have to build your own objects, I found the easiest way was to read each line and use the StringParser to pick it apart. My data holding object was pretty simple -
o A Vector to hold Section objects.
o A Section object with a Vector to hold each Entry object.
o An Entry object
o Appropriate getters and setters to look up stuff I wanted or to insert it.
My model for the object was the Borland C++ IniFile object, but I separated the I/O so that I could read or write from any stream I wished, including just a long string.
o an internal object for section, an internal object for entry

Similar Messages

  • How to read the content of a text file (by character)?

    Guys,
    Good day!
    I'm back just need again your help. Is there anyone knows how to read the content of a text file not by line but by character.
    Please help me. Thank you so much in advance.
    Jojo

    http://java.sun.com/javase/6/docs/api/index.html
    package java.io
    InputStream.read(): int
    Reads the next byte of data from the input stream.
    Implementation:
    InputStreamReader
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes them into characters using a specified charset. The charset that it uses may be specified by name or may be given explicitly, or the platform's default charset may be accepted.

  • How to read the content of ms-word file use pure java???

    how to read the content of ms-word file use pure java???

    hi,
    check this: http://jakarta.apache.org/poi/

  • Help on how to read the content of an XML file from the payload

    I have a receiver channel / mail adapter, that sends e-mails with a XML attachment.
    I’m trying to write a Bean, that should make it possible to rename the attached XML file dynamically.
    In the Bean I want to read the content of the attached XML file, it could be the “order number”.
    The filename should then be “Order number”.XML.
    <u><i>Can anyone help me with how to read the content of the XML file from the payload.</i></u>
    <i><b>Frank</b></i>

    hi,
    check this: http://jakarta.apache.org/poi/

  • How to read the content of this excel file in LV

    Hi could you please let me know how can I read the content of this excel file using the Read From Speardsheet function. It contains text and numbers
    Thanks
    The excel file is attached
    Attachments:
    Datalogging.zip ‏307 KB

    Check attached VI.
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.
    Attachments:
    ReadFromExcel.vi ‏27 KB

  • How to read the contents of a text file and populate the data in a table ?

    Hello All,
      Can anyone advise on how to acheieve the above ? I am trying to read in a text file (CSV) and have the contents populated to the respective UI elements in a table. Any help is greatly appreciated.
    from
    Kwok Wei

    Hi,
    Let us consider you have list of names(Seperated by delimeter) in a text file and you want to display in  a table.
    1. Create Context Node "Names" and context attribute "Name"
    2. Create Table and bind to the above context.
    3.Write the following code in the "Init method.
    try{
    FileReader f =new FileReader("");
    BufferedReader r=new BufferedReader(f);
    String names=r.readLine();
    Vector Names=new Vector();
    // Use Tokenizer and store all the names i a vector//
    for(int i=0;i<Names.size();i++){
    IPrivate<<VieName>>.INameElement ele=wdContext.createNameElement();
    ele.set<<Name>>( Names.get(i).toString());
    wdContext.NodeName().addElement(ele);
    Regards, Anilkumar
    Message was edited by: Anilkumar Vippagunta

  • How to read the tail of a large file?

    My application writes to a log file. I want to read the end (say last 100 lines) of the logfile and display it on a web page. I dont want to read the entire log file as everything apart from the last 100 lines is irrelevant. Is there a way to do this? The only thing i can think of is to do this on a linux command prompt "tail logfile.txt > storehere.txt " and then read storehere.txt. Not ideal. Is there a way i can read the last 100 lines or better still have a continous stream of the last 100 lines of the log file?

    This question has been ask here before; but, I am not sure that a good solution was found.
    Assuming the file does not have fixed length records (then it would be easy), the only thing I can think of is:
    Use RandomAccessFile to read the bytes in the file backwards and store them until you have processed 100 lines. In reality, you would probably not want to read one byte at a time but read "chucks" of the file into a buffer and process those bytes. Similar to how BufferedInputStream works only getting the bytes in reverse order.
    I.E.
    Create a class that returns a byte of the file in reverse order. This class would fill a buffer with a chuck as needed.
    One big issue with this idea is if you are reading Unicode characters - multiple bytes would need to be consumed to pass back a character and since not all Unicode characters are 2-bytes, this could get messy.

  • How to read the 'date modified' of a file?

    I need to read the date that a file was modified so I can see
    if it has been updated. The file is just a text file in the same
    directory as my swf file.
    I tried using FLfile.getModificationDate, but it doesn't seem
    to work. Every way I write the code, I get no response. It does not
    seem to find the file. I even tried using the FLfile.write as a
    test, without luck. I searched and the FLfile.dll is on my machine,
    but I wonder if I have to somehow let the flash file know its
    there.
    I also tried using FileReference.modificationDate, but from
    what I have come to understand, I need to populate the
    FileReference object and that populating the FileReference object
    involves uploading or downloading the file. I'm not up or
    downloading the file, I just need to know if it has been updated by
    other software. Otherwise, how do I populate the FileReference
    object. Can it check on dates without up or downloading?
    Does anyone have an idea of the best way to read the date
    that the file was modified?
    Thank you.

    quote:
    Originally posted by:
    Point Happy
    I searched and the FLfile.dll is on my machine, but I wonder
    if I have to somehow let the flash file know its there.
    quite right, you need to create a Project (and a JavaScript
    file)
    then you can use the JavaScript that you want to use

  • How to read the extended-cache-config.xml file. in C++ API

    I want to create my own XML config file and define the config values in that, so that C++ Client (using Coherence C++ API) application can access the config files.
    Also how to get the instance of configuration values which Coherence client has read,
    i.e.
    TangosolCoherenceOverride=$PATH/examples/config/tangosol-coherence-override.xml
    TangosolCoherenceCacheconfig=$PATH/examples/config/extend-cache-config.xml
    How to get the instance of this XMLDocument ? and read values from it.
    Thanks,
    Naveen

    Hi,
    You can get the cache-config that was read by getting it from the ConfigurableCacheFatory (which you can get from the CacheFactory) via getConfig(). See:
    http://download.oracle.com/otn_hosted_doc/coherence/352CPP/classcoherence_1_1net_1_1_cache_factory.html
    http://download.oracle.com/otn_hosted_doc/coherence/352CPP/classcoherence_1_1net_1_1_configurable_cache_factory.html
    There is no way to get the actual XmlDocument object from the cluster that is read for the cluster-config (though you could open the same path yourself).
    thanks,
    -Rob

  • How to read the data in a txt file on a web site?

    I want to extract the numbers located in txt files on a web site. It's a normal url. Not a ftp.
    Does anyone know how to do it?

    Hi Tom,
    What do you want to extract from the text file??
    I wanted to extract an IP address from a pearl script from my FTP server and this was the vi that I used .I dont know if you are trying to do the same?
    Here is the vi.It is in LV 7.1
    Hope its helps .
    Good luck.
    ohiofudu.
    Certified LabVIEW Architect
    Certified TestStand Developer
    Attachments:
    PublicIP-Adresse.vi ‏31 KB

  • How to read the particular line in a file !!!

    i want to read the 5th , 8th or some other line number of the file. This file is consists of many data arranged by line number. I'm able to retrieve the LineNumber of the file but i'm not able to point the curser to that particular line so it can read that line only.
    i'm pointing the cursor to that particular linenumber as in.setLineNumber(5) it moves to that particular line but after that when i try to read that particular line i'm not able to read that line.
    could any one tell me which is the other way to read that particular line or in this only where i'm doing wrong...
    i need this urgent....

    As is typical of people who claim their problem is urgent, you posted this in the wrong forum (it doesn't have anything to do with JSP) and you left out any details that might help us understand what you are blathering about.
    So take a deep breath. It isn't urgent. There is no rush. Now formulate a proper description of your problem and post it in the proper forum.

  • URGENT: How to read the content of a PDF-file in Java?

    Hello
    What I need are some classes which can read a pdf and translate it in normal Text, so that I can write the content of the pdf in my database.
    Where can I find those classes? Or how else could I get there?

    www.lowagie.com/itext
    www.etymon.com/pj
    www.retep.org.uk/pdf
    www.pdflib.comwww.pdfzone.com
    www.planetpdf.com
    www.purepdf.com
    www.adobe.com
    www.pdfstore.com
    www.adobe.com/proindex/acrobat/formsresources.html
    www.partners.adobe.com/asn/developer/acrosdk/forms.html
    www.rrsys.com
    www.javafoundry.com/javapdf
    www.novagraphix.com/internet_publishing_with_acrobat/forms/forms_tutorial.html
    www.binarything.com

  • How to read the data from an excel file into MYSQL by java language

    Hi all,
    I have some data in excel spread sheet and I want to put the data into MYSQL data base. I created the tables in MYSQL> How can I write a program in JAVA that puts the value from excel sheet to mysql??
    I would appreciate your help
    regards

    By typing code at the keyboard... but presumably you meant to ask what code you should type.
    To get data out of Excel there are a few alternatives. The Google keywords I would use to find them are "java excel". I use Apache POI but there are other possibilities, I believe. As for getting the data into MySQL once you have extracted it from Excel, you would use JDBC. But you already knew that, didn't you? You did find the JDBC forum.
    In general it's better to ask a specific question on a forum. If you don't have a clue (which is the way we all start out) then just telling people that isn't going to be helpful. The best you're going to get is links to tutorials, which you could perfectly well have found for yourself by simple web searches.

  • How to read the name of a PDF file? - function module

    Hi,
    I have <b>some individual pdf documents in my desktop</b>.I need to <b>bulk-upload it to the content server and document related information to the SAP-DB</b>.
    Need your guidance.
    Regards,
    John.

    try this code it will convert file to PDF file
    REPORT  ZWARUN_CONVERSION_PDF                        .
    ***********Tables***************
    TABLES:VBRK.
    ***********Data Declaration***************
    DATA: LV_NUMBYTES TYPE I,
          LV_SPOOLNO TYPE TSP01-RQIDENT.
    DATA:C_LAYOUT  LIKE PRI_PARAMS-PAART VALUE 'X_65_132', "Layout
          C_X       TYPE C VALUE 'X'.
    DATA: NUMBYTES TYPE I,
           CANCEL.
    ***************Internal table of Pdf************
    DATA: IT_PDF LIKE TLINE OCCURS 10 WITH HEADER LINE.
    DATA:BEGIN OF IT_VBRK OCCURS 2,
         FKART LIKE VBRK-FKART,
         FKTYP LIKE VBRK-FKTYP,
         VBTYP LIKE VBRK-VBTYP,
         END OF IT_VBRK.
    SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME.
    SELECT-OPTIONS: S_BUKRS FOR VBRK-BUKRS,
                    S_GJAHR FOR VBRK-GJAHR.
    SELECTION-SCREEN END OF BLOCK BLK .
    PARAMETERS:
    spoolno like tsp01-rqident,
      DOWNLOAD AS CHECKBOX DEFAULT 'X',
      P_FILE LIKE RLGRAP-FILENAME DEFAULT 'C:\warun1.pdf'.
    START-OF-SELECTION.
    SELECT FKART
              FKTYP
              VBTYP
           INTO  TABLE IT_VBRK
           FROM VBRK
           WHERE  BUKRS IN S_BUKRS
              AND GJAHR IN S_GJAHR.
    END-OF-SELECTION.
      DATA: LK_PARAMS TYPE PRI_PARAMS,
            LV_VALID.
    if not p_mailid is initial.
    All the parameters passed are constants, so exceptions
    doesn't get raised
        CALL FUNCTION 'GET_PRINT_PARAMETERS'
          EXPORTING
            IMMEDIATELY    = ' '
            LAYOUT         = C_LAYOUT                           "'X_65_132'
            NO_DIALOG      = C_X
          IMPORTING
            OUT_PARAMETERS = LK_PARAMS
            VALID          = LV_VALID.
        IF LV_VALID <> SPACE .
          NEW-PAGE PRINT ON PARAMETERS LK_PARAMS NO DIALOG.
    *--To display the final report
          PERFORM PRINT_REPORT.
          NEW-PAGE PRINT OFF.
    *---To convert the download to PDF
          PERFORM CONV_TO_PDF_DOWNLOAD.
          PERFORM DOWNLOAD.
        ENDIF.
    endif.
    *--To display the final report
      PERFORM PRINT_REPORT.
    *&      Form  print_report
    FORM PRINT_REPORT .
    *write:/ 'I will do it' color 4.
    write:/ 'Yes' color 4.
    write:/ 'we will do it' color 4.
    write:/ 'lets talk abt changing life style' color 4.
    write:/'By warun'.
    LOOP AT IT_VBRK.
    WRITE:/ IT_VBRK-FKART,IT_VBRK-FKTYP,IT_VBRK-VBTYP.
    ENDLOOP.
    ENDFORM.                    " print_report
    *&      Form  conv_to_pdf_download
    FORM CONV_TO_PDF_DOWNLOAD .
    CLEAR IT_VBRK.
    WAIT UP TO 2 SECONDS.
    LV_SPOOLNO = SY-SPONO.
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
       EXPORTING
         SRC_SPOOLID                    =  LV_SPOOLNO
        NO_DIALOG                      = ''
       DST_DEVICE                     =
       PDF_DESTINATION                =
      IMPORTING
        PDF_BYTECOUNT                  = LV_NUMBYTES
       PDF_SPOOLID                    = pdfspoolid
       LIST_PAGECOUNT                 =
       BTC_JOBNAME                    = jobname
       BTC_JOBCOUNT                   = jobcount
      TABLES
        PDF                            = IT_PDF.
    ENDFORM.                    " conv_to_pdf_download
    *&      Form  download
    FORM DOWNLOAD .
    download PDF file ***********
    CHECK DOWNLOAD = 'X'.
    CALL FUNCTION 'DOWNLOAD'
         EXPORTING
              BIN_FILESIZE = LV_NUMBYTES
              FILENAME     = P_FILE
              FILETYPE     = 'BIN'
         IMPORTING
              ACT_FILENAME = P_FILE
              FILESIZE     = LV_NUMBYTES
              CANCEL       = CANCEL
         TABLES
              DATA_TAB     = IT_PDF.
    IF CANCEL = SPACE.
      WRITE: / LV_NUMBYTES, P_FILE.
    ENDIF.
    ENDFORM.                    " download

  • How to read the content in one node of XML in Java? Pls help

    My dear brothers,
    I am a newbie of XML, I have a exercise which is creating a Tree View from XML file. But the trouble is I do not know how to read the content in one node of XML file. I decide to use the algorithm as following:
    1. Create a GUI form which gives the ability for user to choose a XML file (ok)
    2. Load XML and return the file (ok)
    3. Read the file from node to node to create the node in Tree View (?!)
    Please help me, and if you are enough kind, please give me an small example to easy understand. Thanks in advance.
    Hoang Yen Binh

    I hope this one helps you.
         <ABC Type="ProductBased" ProdName="One" Location="India">
              <CEO>Raj</CEO>
              <Finance>Vikram</Finance>
              <HR>Karthik</HR>
              <Technical>Satish</Technical>
         </ABC>
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.NamedNodeMap;
    import org.w3c.dom.Attr;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Node;
    import org.w3c.dom.DOMException;
    import javax.xml.parsers.ParserConfigurationException;
    import org.xml.sax.SAXException;
    import java.io.File;
    import java.io.IOException;
    public class XmlReading {
         Document doc;
         Element element;
         public static void main(String[] args) throws Exception{
              XmlReading xr = new XmlReading();
              xr.getXmlParser(args);
         public void getXmlParser(String[] args) {
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                   if(args.length != 1) {
                        System.err.println("Argument Required");
              try {
                   DocumentBuilder builder = factory.newDocumentBuilder();
                   doc = builder.parse(new File(args[0]));
              }catch(ParserConfigurationException e1) {
              }catch(SAXException e2) {
              }catch(IOException e3) {
              getAttributes();
         public void getAttributes() {
              // Retrive the entire Document from the Dom Tree
              element = doc.getDocumentElement();
    //          System.out.println(element);
              NamedNodeMap attrs = element.getAttributes();
              // Get number of attributes in the element
         int numAttrs = attrs.getLength();
         // Process each attribute
              for (int i=0; i<numAttrs; i++) {
                   Node node = attrs.item(i);
                   // Get attribute name and value
                   String attrName = node.getNodeName();
                   String attrValue = node.getNodeValue();
                   System.out.println(attrName + ": " + attrValue);
              String s1 = element.getTagName();
              System.out.println(s1);
              // To get all the elements in a DOM Tree
              NodeList nl1 = element.getElementsByTagName("*");
              int i2 = nl1.getLength();
              System.out.println(i2);
              for(int i=0; i<i2; i++) {
                   System.out.println(nl1.item(i) + "\n");
    }

Maybe you are looking for