How to read a file content for editing?

Now i am using FileInputStream to read its content by bytes. How do i read the content line by line as string so that i am able to do some editing using replace().

    public String load() throws FileNotFoundException, IOException {
         BufferedReader r = new BufferedReader(new FileReader(new File(this.getClass().getResource(filename).getPath())));
         String s = r.readLine();
         StringBuffer result = new StringBuffer();
         while (s != null) {
              result.append(s + "\n");
              s = r.readLine();
         r.close();
         return result.toString();

Similar Messages

  • How to read trace file content

    Hi,
    DB :11.2
    How to read trace file content.It's only for ORACLE SUPPORT?
    calling         
    call
    entry           
    argument values in hex
    location        
    type
    point           
    (? means dubious value)
    ksedst()+31     
    call
    ksedst1()       
    000000000 ? 000000001 ?
    7FFF19B98CA0 ? 7FFF19B98D00 ?
    7FFF19B98C40 ? 000000000 ?
    ksedmp()+610    
    call
    ksedst()        
    000000000 ? 000000001 ?
    7FFF19B98CA0 ? 7FFF19B98D00 ?
    7FFF19B98C40 ? 000000000 ?
    ksfdmp()+21     
    call
    ksedmp()        
    000000003 ? 000000001 ?
    7FFF19B98CA0 ? 7FFF19B98D00 ?
    7FFF19B98C40 ? 000000000 ?
    kgerinv()+161   
    call
    ksfdmp()        
    000000003 ? 000000001 ?
    7FFF19B98CA0 ? 7FFF19B98D00 ?
    7FFF19B98C40 ? 000000000 ?
    kgeasnmierr()+163
    call
    kgerinv()       
    0069107E0 ? 011F80370 ?
    7FFF19B98D00 ? 7FFF19B98C40 ?
    000000000 ? 000000000 ?
    kssmov()+502    
    call
    kgeasnmierr()   
    0069107E0 ? 011F80370 ?
    7FFF19B98D00 ? 7FFF19B98C40 ?
    000000029 ? 0D3F1C600 ?
    kfncInitSlavePool()  call
    kssmov()        
    0D3F1C5D0 ? 000000000 ?
    +203                                          
    7FFF19B98D00 ? 7FFF19B98C40 ?
    000000029 ? 0D3F1C600 ?
    kfncWorkMsgAlloc()+  call
    kfncInitSlavePool()  0D3F1C5D0 ? 000000000 ?
    83                                            
    7FFF19B98D00 ? 7FFF19B98C40 ?
    000000029 ? 0D3F1C600 ?
    kfncFileUnidentify(  call
    kfncWorkMsgAlloc()   0D3F1C5D0 ? 7FFF19B99AD0 ?
    )+635                                         
    7FFF19B98D00 ? 7FFF19B98C40 ?
    000000029 ? 0D3F1C600 ?
    kffmRequestFree()+1  call
    kfncFileUnidentify(  7FFF19B99BC8 ? 7FFF19B99BC0 ?
    Br,
    Raj

    One needs to know the meaning of the kernel functions and their working within the oracle database. I guess, oracle support can do the analysis more easily as they have access to the software code  as well necessary tools to interpret these internal routines.
    Aman....

  • How to read entire file content in one XML tag?

    Hi,
    How can I read entire file content in one XML tag?
    What specifications do I need to specify in Sender adapter?
    regards,
    Anirudh.

    Hi Chirag,
    I am reading a flat file for File to Idoc scenario.
    Target Idoc is nested which can not be populated with graphical mapping.
    see below post for more detail.
    [Mapping flat XML to nested IDOC using node functions |Mapping flat XML to nested IDOC using node functions;
    The problem here is I'm not able to identify when to insert context change for child which is repeating for a repeating parent.
    Solution therefore, I think is reading entire flat structure in one node and then use UDF to populated intermediate target with proper nesting.
    Thats why I need to read entire XML.
    regards,
    Anirudh.

  • How to read text file content in portal application?

    Hi,
    How do we read text file content in portal application?
    Can anyone forward the code to do do?
    Regards,
    Anagha

    Check the code below. This help you to know how to read the text file content line by line. You can display as you require.
    IUser user = WPUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
    IResourceContext resourceContext = new ResourceContext(user);
    String filePath = "/documents/....";
    RID rid = RID.getRID(filePath);
    IResource resource = ResourceFactory.getInstance().getResource(rid,resourceContext);
    InputStream inputStream = resource.getContent().getInputStream();
    BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
    String line = reader.readLine();
    while(line!=null) {
          line = reader.readLine();
         //You can append in string buffer to get file content as string object//
    Regards,
    Yoga

  • How to read a file content from portal

    Hi experts,
    I have a file (xml or xlsx), which i have kept in D drive.
    then using GUI_UPLOAD, i have read file content into internal table. then i am proceeding furthur.
    but in real, my file will be in portal (means https:\\in.xyz.com\........\TEST.XML
    in this case i can not use GUI_UPLOAD.
    can any one suggest how can i achieve above. Thanks.
    Regards,
    Venkata Prasad

    Hi venkata
    try this code below
    tables: znks_exceldb.
    types: begin of wa_input,
           emp_id type string,
           name type string,
           middle type string,
           last_name type string,
           address type string,
           acc_num type string,
           mobile type string,
    end of wa_input.
    data: gt_intern type kcde_intern.
    data:gwa_intern type kcde_intern_struc.
    data gt_input type table of wa_input.
    data gwa_input like line of gt_input.
    data it_tab type table of znks_exceldb.
    data it_wa like line of it_tab.
    constants c_seprator type c value ','.
    parameters ex_file type localfile obligatory.
    at selection-screen on value-request for ex_file.
      call function 'F4_FILENAME'
    * EXPORTING
    *   PROGRAM_NAME        = SYST-CPROG
    *   DYNPRO_NUMBER       = SYST-DYNNR
    *   FIELD_NAME          = ' '
       importing
         file_name           = ex_file.
    start-of-selection.
      perform readfile using ex_file.
      perform insert.
      perform display.
    form readfile using ex_file type localfile.
      data:lv_filename type rlgrap-filename.
      data: lv_index type i.
      field-symbols: <> type any.
      lv_filename = ex_file.
      call function 'KCD_CSV_FILE_TO_INTERN_CONVERT'
        exporting
          i_filename      = lv_filename
          i_separator     = c_seprator
        tables
          e_intern        = gt_intern
        exceptions
          upload_csv      = 1
          upload_filetype = 2
          others          = 3.
      if sy-subrc <> 0.
    * Implement suitable error handling here
      endif.
      loop at gt_intern into gwa_intern.
        move gwa_intern-col to lv_index.
        assign component lv_index of structure gwa_input to <>.
        move:gwa_intern-value to <>.
        at end of row.
          append gwa_input  to gt_input.
          clear gwa_input.
        endat.
      endloop.
    endform.
    form insert.
      loop at gt_input into gwa_input.
        it_wa-emp_id = gwa_input-emp_id.
        it_wa-name = gwa_input-name.
        it_wa-middle = gwa_input-middle.
        it_wa-last_name = gwa_input-last_name.
        it_wa-address = gwa_input-address.
        it_wa-mobile = gwa_input-mobile.
        it_wa-acc_num = gwa_input-acc_num.
        append it_wa to it_tab.
      endloop.
      insert znks_exceldb from table it_tab accepting duplicate keys.
    endform.
    form display.
      loop at gt_input into gwa_input.
        write :/ gwa_input-emp_id,
                 gwa_input-name,
                 gwa_input-middle,
                 gwa_input-last_name,
                 gwa_input-address,
                  gwa_input-mobile,
                  gwa_input-acc_num .
      endloop.
    endform.
    Regards
    Niraj Sinha

  • How to read a file content in a ordinary java program

    Please help me is there is any method is available to read the content of the file.I am asking in pure java not in the servlets.Guys please help me.I got structed here

    Reading a text file in the systems character encoding: use the class java.io.FileReader. You can wrap a BufferedReader around it to get better performance (and a simple way to read lines)
    Reading a text file in another character encoding: use FileInputStream and convert it to a reader with:
    InputStreamReader reader = new InputStreamReader(fileStream, encoding);
    where encoding is the character encoding as a String (like "Cp850" or "UTF-16LE"). Again, you can wrap a BufferedReader around that reader.
    Reading a binary file: open a FileInputStream to the file and just read the bytes from it. You can use BufferedInputStream for better performance and DataInputStream to get a simple way to read primitive types like double and char.
    Please help me is there is any method is available to
    read the content of the file.I am asking in pure java
    not in the servlets.Guys please help me.I got structed
    hereAren't servlets pure Java?

  • How to read the file from a folder.

    Hi All,
    How to read the file from a folder or directory from the non sap server / remote server.
    Regards
    Sathis

    open dataset filename for input in text mode
                         encoding default.
    filename is character type variable with the destination filename.
    Edited by: Jino Augustine on Apr 19, 2010 1:31 PM

  • I converted a PDF document to word.  How do I unlock this document for editing?

    How do I unlock a document for editing if it is in read only form?

    Hi buklova,
    Is it happening with this file only or with every files?
    Would you send your PDF document to [email protected] as an email attachment? 
    I will check it from my end.Please add the link to this forum post for reference.
    Regards,
    Florence

  • How to download a file/contents through a session bean to the bean client

    Hi All,
    I'm a newbie to enterprise beans and facing a problem. I have a requirement where an excel file saved on the server will be a accessed by a session bean and return it to the bean client (developed in swing). Client will display the file contents, user edits the contents and saves. Pressing the save button will save the excel on the server again using the same session bean.
    As far as displaying the contents of excel on the form/panel is concerned I have developed this part and able to load files and save them on my local machine.
    But my main requirement is to load it through Session Bean and then save it back on the server. An EJB 2.0 code snippet addressing this part would be a great help.
    Thanks,

    and where's the problem?
    I see 2 EJB calls, one to retrieve the data and another one to send it back to the server.
    That's the simplest scenario, easy to implement using a stateless session bean (though if you want to prevent concurrent modification of the file there's a bit more work to do, like keeping a record of open files).
    A more complex solution would have the client send only the changes to the file (for network performance reasons maybe) and have the EJB merge those in some way with the original document.
    Complex, possibly error prone, probably not worth the effort.
    First scenario should pose no problem if you're familiar with Java and have a passing familiarity with EJB.

  • Need to read text file content and have to display it in multiline text box

    dear all,
    Need to read text file content and have to display it in multiline text box.
    actually im new to file handling. i have tried up to get_line and put_line.
    in_file := TEXT_IO.FOPEN ('D:\SAMPLE.txt', 'r');
    TEXT_IO.GET_LINE (in_file,linebuf);
    i dont know how to assign this get_line function to text item
    pls help me in this regards,

    Simply write:
    in_file := TEXT_IO.FOPEN ('D:\SAMPLE.txt', 'r');
    TEXT_IO.GET_LINE (in_file,linebuf);
    :block2.t1 := chr(10)||:block2.t1||chr(10)||linebuf;
    chr(10) --> is for new line character

  • How to read pmd files on mac?

    How to read pmd files on mac?

    There is no native support to open PageMaker documents on the Mac. I would check to see what PageMaker document versions that InDesign CS6 can open, ether on Mac or PC.
    Adobe still has the trial of PageMaker 7 for Windows (Adobe link) and PM7 PDF, which you could install in Boot Camp, or Mac Virtual Machine in Windows 7.
    I just checked the latest release of LibreOffice, and there is no support for PageMaker anything.
    zamzar dot com does not support .pmd content.

  • How could i activate BI-Content for SPP

    Hello
    How could i activate BI-Content for SPP.
    I only find the reoport RSBCT_BICONTENT_ACTIVATE. But it does not work for SPP
    I geht the following message:
    Finished starting the activation. Please check the application log with external ID BI Content Installer (SCM)
    But in the sm 37 i don't find anything.
    Thanks
    Sven

    Hi MadissonStudios.
    Thanks for the time you took to try and help me out.
    I can't access the link (even correcting the double '//' or the space in the link.
    I've followed your sugesttion and tested it but didn't work. The hover state is always for the top layer (z order) and the hover state of the image fills over the text. If I put the text over, it covers the image. Grouping didn't make a difference.
    Maybe I'm getting your indications wrong, but without access to the file, I don't see another way I could have done it any different.
    Thanks once more.

  • How to read WSDL File

    Hi all,
    I am new in web services...just started yesterday.. my client is provinding web services...I just need to send some data to them and retrieve data back...they are basically verifying addresses..if Address is not corrent then they will send the correct one back..I have no clue which method should I call and how to send data to them..below is my work that I have done so far...please help me...
    ///Below is the Client API that I have made...there is a bean file which I have made for Input Data...
    import org.apache.axis.client.Call;
    import org.apache.axis.client.Service;
    import javax.xml.namespace.QName;
    public class TestClient {
        public static void main(String [] args) {
           try {
             String endpoint = "http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress";
             Service  service = new Service();
             Call     call    = (Call) service.createCall();
            call.setTargetEndpointAddress( new java.net.URL(endpoint) );
            call.setOperationName(new QName("http://m3group101.mnao.net/", "ValidateAddress"));
         call.setUsername("free");
         call.setPassword("account");       
         AddressIn addressIn  = new AddressIn();
            addressIn.Address1 = "6767 Friars Rd";
            addressIn.Address2 = "";
            addressIn.Address3 = "";
            addressIn.Address4 = "";
            addressIn.City = "SAN DIEGO";
            addressIn.StateProv = "CA";
            addressIn.PostalCode = "";
            addressIn.Country = "US";
            String ret = (String) call.invoke(new Object[] {"",""});      ////Here I donno what should I pass
            System.out.println("Sent DATA, got '" + ret + "'");
          } catch (Exception e) {
            System.err.println("Got Error While retrieving data "+e.toString());
    ///My Bean File Looks like this....
    import java.io.*;
    import java.util.*;
    import java.util.ResourceBundle;
    public class AddressIn {
        public String KeyValue;
        public String Address1;
        public String Address2;
        public String Address3;
        public String Address4;
        public String City;
        public String StateProv;
        public String PostalCode;
        public String Country;
        public AddressIn()
             KeyValue   = "";
             Address1   = "";
             Address2   = "";
             Address3   = "";
             Address4   = "";
             City       = "";
             StateProv  = "";
             PostalCode = "";
             Country    = "";
        } // END constructor
    } // END class AddressIn
    import java.io.*;
    import java.util.*;
    import java.util.ResourceBundle;
    public class AddressOut {
        public String KeyValue;
        public String Address1;
        public String Address2;
        public String Address3;
        public String Address4;
        public String City;
        public String StateProv;
        public String PostalCodeBase;
        public String PostalCodeAddOn;
        public String Country;
        public String Status;
        public String StatusCode;
        public String StatusDescription;
        public String Confidence;
        public String RecordType;
        public AddressOut()
             KeyValue   = "";
             Address1   = "";
             Address2   = "";
             Address3   = "";
             Address4   = "";
             City       = "";
             StateProv  = "";
             PostalCodeBase  = "";
             PostalCodeAddOn = "";
             Country    = "";
             Status     = "";
             StatusCode = "";
             StatusDescription = "";
             Confidence = "";
             RecordType = "";
        } // END constructor
    } // END class AddressInPlease see the WSDL File...
    <?xml version="1.0" encoding="UTF-8" ?>
    - <wsdl:definitions targetNamespace="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" xmlns:intf="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://com.g1.dcg/services" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd00="http://www.w3.org/2000/10/XMLSchema" xmlns:xsd99="http://www.w3.org/1999/XMLSchema">
    - <wsdl:types>
    - <schema targetNamespace="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" xmlns="http://www.w3.org/2001/XMLSchema">
      <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
    - <complexType name="ArrayOf_xsd_anyType">
    - <complexContent>
    - <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:anyType[]" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
      </restriction>
      </complexContent>
      </complexType>
    - <complexType name="ArrayOf_tns1_ServiceOption">
    - <complexContent>
    - <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="tns1:ServiceOption[]" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
      </restriction>
      </complexContent>
      </complexType>
    - <complexType name="ArrayOf_tns1_DataRow">
    - <complexContent>
    - <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="tns1:DataRow[]" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
      </restriction>
      </complexContent>
      </complexType>
    - <complexType name="ArrayOf_xsd_string">
    - <complexContent>
    - <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
      </restriction>
      </complexContent>
      </complexType>
      </schema>
    - <schema targetNamespace="http://com.g1.dcg/services" xmlns="http://www.w3.org/2001/XMLSchema">
      <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
    - <complexType name="ServiceOption">
    - <sequence>
      <element name="key" nillable="true" type="xsd:string" />
      <element name="value" nillable="true" type="xsd:string" />
      </sequence>
      </complexType>
    - <complexType name="DataTableBean">
    - <sequence>
      <element name="columnNames" nillable="false" type="impl:ArrayOf_xsd_string" />
      <element name="dataRows" nillable="true" type="impl:ArrayOf_tns1_DataRow" />
      </sequence>
      </complexType>
    - <complexType name="DataRow">
    - <sequence>
      <element name="values" nillable="true" type="impl:ArrayOf_xsd_string" />
      </sequence>
      </complexType>
      </schema>
      </wsdl:types>
    - <wsdl:message name="processResponse">
      <wsdl:part name="arg0" type="tns1:DataTableBean" />
      </wsdl:message>
    - <wsdl:message name="processRequest">
      <wsdl:part name="arg0" type="impl:ArrayOf_tns1_ServiceOption" />
      <wsdl:part name="arg1" type="tns1:DataTableBean" />
      </wsdl:message>
    - <wsdl:portType name="G1Service">
    - <wsdl:operation name="process" parameterOrder="arg0 arg1">
      <wsdl:input message="impl:processRequest" name="processRequest" />
      <wsdl:output message="impl:processResponse" name="processResponse" />
      </wsdl:operation>
      </wsdl:portType>
    - <wsdl:binding name="ValidateAddressSoapBinding" type="impl:G1Service">
      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
    - <wsdl:operation name="process">
      <wsdlsoap:operation soapAction="ValidateAddress" />
    - <wsdl:input name="processRequest">
      <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" use="encoded" />
      </wsdl:input>
    - <wsdl:output name="processResponse">
      <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" use="encoded" />
      </wsdl:output>
      </wsdl:operation>
      </wsdl:binding>
    - <wsdl:service name="ValidateAddress">
    - <wsdl:port binding="impl:ValidateAddressSoapBinding" name="ValidateAddress">
      <wsdlsoap:address location="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" />
      </wsdl:port>
      </wsdl:service>
      </wsdl:definitions>I am receiving Exception " No Such Operation "
    I am sorry but I don'n know how to read WSDL file...
    thanks
    Vish...
    Message was edited by:
    vishu007

    Start going through the tutorials that come with Axis (you didn't state which version of Axis you're using btw, and there are major differences between them).
    Anyway, the wsdl you list doesn't have an operation called "ValidateAddress". It has only one operation, called "process".
    The call takes 2 arguments, as defined in the input message, and returns one value as defined in the output message.
    Had you used Axis to generate your classes for you that would all have become quite obvious.

  • How to read Sool file

    hi all
    can any1 tell me how should i read spool file
    i want to read tht spool and then send it to person automatically
    i can read that by sp01 but how to read that file in flat file or direcly send .
    Jimmy

    Jimmy,
    Basically you need to work with Basis peple in the transaction SCOTT.
    One FM you can use for sending email is SO_NEW_DOCUMENT_SEND_API1
    See the blog on this : /people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
    Regards,
    Hari
    Thanks for the points..
    Message was edited by: Hari Kiran Y

  • How to read .xml file from embedded .swf(flash output) in captivate

    I have been trying to read .xml file from the .swf (Flash output) that is embedded within the captivate file but no luck yet . Please if anyone got any clue on how get this thing done using Action script 3.0 then let me know. I am using Adobe Captivate 5.5 at present and Flash CS 5.5.
    I am well aware about how to read .xml file through action script 3.0 in flash but when insert the same flash in captivate and publish nothing comes in captivate output. I would higly appreciate if anyone could help me out with that.
    Here is is graphical demonstration of my query :
    Message was edited by: captainmkv

    Hi Captainmkv,
    Does the information in this post cover what you're trying to do: http://forums.adobe.com/message/5081928#5081928
    Tristan,

Maybe you are looking for