Code for reading the and placing the file using java webservice

Hi All,
Can anybody can guide me on how to read a file and place the file using java.
Let  me know if any code is available which has been completed using java.
Regards,
Rahul

Hi,
The "square" symbol that you are referring to is probably a CRLF (Carriage Return - Life Feed) Control Character.
This is more commonly known as a "Enter" at the end of a line / sentence.
To clean this character from strings in Java, please use:
String patternStr = "(?m)$^|[\\r\\n]+\\z";
String replaceStr = " ";
Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher(inputStr);
return matcher.replaceAll(replaceStr);
Hope that helps.
Thanks.
p256960.

Similar Messages

  • Code for reading particular  fields from the file placed in application

    hi,
    code for reading particular  fields from the file placed in application server in to the internal table.

    Hi,
    Use the GUI_UPLOAD FM to upload the File into ur Internal Table.
    DATA : FILE_TABLE TYPE FILE_TABLE OCCURS 0,
             fwa TYPE FILE_TABLE,
             FILENAME TYPE STRING,
             RC TYPE I.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
      EXPORTING
        WINDOW_TITLE            = 'Open File'
       DEFAULT_EXTENSION       =
       DEFAULT_FILENAME        =
       FILE_FILTER             =
       INITIAL_DIRECTORY       =
       MULTISELECTION          =
       WITH_ENCODING           =
      CHANGING
        FILE_TABLE              = FILE_TABLE
        RC                      = RC
       USER_ACTION             =
       FILE_ENCODING           =
      EXCEPTIONS
        FILE_OPEN_DIALOG_FAILED = 1
        CNTL_ERROR              = 2
        ERROR_NO_GUI            = 3
        NOT_SUPPORTED_BY_GUI    = 4
        others                  = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE FILE_TABLE INDEX 1 into fwa.
    FILENAME = fwa-FILENAME.
        CALL FUNCTION 'GUI_UPLOAD'
             EXPORTING
                  filename                = filename
                  FILETYPE                = 'DAT'
           IMPORTING
                FILELENGTH              =
             TABLES
                  data_tab                = itab
             EXCEPTIONS
                  file_open_error         = 1
                  file_read_error         = 2
                  no_batch                = 3
                  gui_refuse_filetransfer = 4
                  invalid_type            = 5
                  OTHERS                  = 6 .
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    Regards,
    Balakumar.G
    Reward Points if helpful.

  • HT1725 I had an itunes redemption code for a movies and got the following message: "code redemption temporarily unavailable. Try again later." several times.  How do I get my movie?

    I had an itunes redemption code for a movie and got the following message, "code redemption temporarily unavailable. try again later."  How do I get my movie?

    Hi r.viel,
    I'm sorry to hear you are having issues with your redemption code.
    The following article should help you with this:
    iTunes Store: Invalid, inactive, or illegible codes
    If you're still unable to redeem your code after verifying the characters in the code, you'll need to contact iTunes Store Support for help. You'll need to provide a digital image of the front and back of the gift card as well as the sales receipt for the purchase of the gift card.
    Contacting iTunes Store Support
    Go to the iTunes support page and select your iTunes country.
    From the iTunes support page, choose Contact Support on the lower-left side of the page.
    Follow the instructions to get iTunes Store support assistance.
    I hope this information helps ....
    Have a great day!
    - Judy

  • How do i search for a string in a txt file using java??

    How do i search for a string in a txt file using java??
    could you please help thanks
    J

    Regular expressinos work just fine, especially when
    searching for patterns. But they seem to be impying
    it's a specific group of characters they're looking
    for, and indexOf() is much faster than a regex.If he's reading from a file, the I/O time will likely swamp any performance hit that regex introduces. I think contains() (or indexOf() if he's not on 5.0 yet) is preferable to regex just because it's simpler. (And in the case of contains(), the name makes for a very clear, direct mapping between your intent and the code that realizes it.)

  • Read, Modify and Apply Report XML using Java Script

    Hi Guys,
    Is there any way that we can Pragmatically Read, Modify and Apply Report XML using Java Script or some other way.
    Thanks
    Kaushik
    Edited by: Kaushik K on Jun 20, 2012 8:36 PM

    Requirement ::
    Users should be able to add Column to the Report Dynamically at Runtime.
    (There are around 1000+ Users, Answers Approach is not acceptable)
    So we are planning to provide a Multi Select / Shuttle Box Option for Users to add Columns dynamically. (Only for Table View)
    What we planned to DO ::
    Create a Presentation Variable Prompt, Which reads the Metadata Table (Presentation Table.Column Name, populated using the Metadata Dictionary)
    And Create a report with One Column and the Column Fx like @{var_dynamic_columns}{'"Time"."Year","Time"."Month"'}
    With this, OBIEE is rewriting the Logical SQL Currently as "Select "Time"."Year","Time"."Month" from "A - Sample Sales" "
    But getting an error
    The number of columns returned in retrieving column metadata was invalid (expected: 1; received: 2)
    So we want to see, if we can rewrite the Advanced XML of the Report to have dynamic columns based on the Values from the Presentation Variable.
    Please help me if this is a viable solution or any other better solution.

  • Zip and extract multiple files using java program

    how can i zip and extract multiple files using java program.

    Hi,
    Look into the java.util.zip and java.util.jar they expose methods to manipulate zip and jar files.

  • Can u please send me a sample code to upload and download a file using java

    Hi,
    Please can u send me a sample code to upload a file and to download the same file from a remote server using a java servlets. The file should be read byte by byte.
    Message was edited by:
    user461713

    Hi, Thank u.
    Sorry, I forgot to attach a code. Here it is.
    Actually i need to upload a file to a remote server and download it from a server to my machine. I'm trying it using servlets and using tomcat5.0 as a servlet container. Here i'm sening a code used to upload a file. Let me know whether it works. Only few lines are here.
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.lang.Object;
    import java.util.*;
    import java.lang.String;
    import com.oreilly.servlet.MultipartRequest;
    public class FileUpload extends HttpServlet{
         public void doPost(HttpServletRequest req, HttpServletResponse res)throws
         ServletException, IOException{
         MultipartRequest multi=new MultipartRequest(req);     
         String file="file1";
         byte[] b=file.getBytes();
         InputStream in=null;
         BufferedInputStream bis=null;
         FileWriter fw=null;
    try{
         in=multi.getInputStream("file1");
    bis=new BufferedInputStream(in);
         File output=new File("/fileuploadtest");
         fw=new FileWriter(output);
              int i;
              i=bis.read();
              while (i != -1) {
    fw.write(i);
    i = bis.read();
         catch(IOException e){
              System.out.println("Exception=" +e);
    finally{
         try{
              if(in!=null)
              in.close();
              if(bis!=null)               
              bis.close();
              if(fw!=null)
              fw.close();
         catch(Exception e){
              System.out.println(e);
    This code is giving error as: cannot resolve symbol: class MultipartRequest
    Why is this happening?
    Pls let me know whether this code works or no and also i have written form.html.
    Can u pls tel me whether there are ways in which i can write a code to upload a file using servlets without using third party packages. Pls help.
    Also how should be the servlet mapping for this code.?
    Regards
    Message was edited by:
    user461713

  • I entered my redemption code for Elements 13 and get : The code you entered is invalid. Please try again.

    I don't know what is going on. I entered the code 3 times and still get the same message.

    See if anything here helps:
    Redemption Code Help

  • How to read the and Write the PDF file give me the solution

    Hi all,
    How to read the and Write the PDF file give me the solution
    My coding is
    import java.io.File;
    import com.asprise.util.pdf.PDFImageWriter;
    import com.asprise.util.pdf.PDFReader;
    import java.io.*;
    import java.io.FileOutputStream;
    public class example {
    // public example() {
         public static void main(String a[])
              try
              PDFReader reader = new PDFReader(new File("C:\\AsprisePDF-DevGuide.pdf"));
                   reader.open(); // open the file.
                   int pages = reader.getNumberOfPages();
                   for(int i=0; i < pages; i++) {
                   String text = reader.extractTextFromPage(i);
                   System.out.println("Page " + i + ": " + text);
    // perform other operations on pages.
    PDFImageWriter writer = new PDFImageWriter(new FileOutputStream("c:\\new11.pdf"));
                   writer.open();
                   writer.addImage("C:\\sam.doc");
                   writer.close();
                   System.out.println("DONE.");
    reader.close();
              catch(Exception e){System.out.println("error:"+e);
              e.printStackTrace();
    I get the pdf content then it returns the string value but ther is no option to write the string to PDF, and we only add a image file to PDF,but i want to know how to wrote the string value to PDF file,
    Please give response immtly
    i am waiting for your reply.
    thanks,
    Suresh.G

    I have some question flow
    How library to use this code.
    I try runing but have not libary.
    Please send me it'library
    Thank you very much!

  • How to read the data from Excel file and Store in XML file using java

    Hi All,
    I got a problem with Excel file.
    My problem is how to read the data from Excel file and Store in XML file using java excel api.
    For getting the data from Excel file what are all the steps i need to follow to get the correct result.
    Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
    Thanks & Regards,
    Sreenu,
    [email protected],
    india,

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • Why won't Apple give out the unlock code for an iPhone 3Gs when the contract was honored and I am still an AT

    Why won't Apple give out the unlock code for an iPhone 3Gs when the 2  year contract was honored and I continued to be an AT&T customer with an iPhone 4. I wanted my old 3gs unlocked so my daughter could use it overseas when she is deployed. AT&T service over there *****, the international plan was not worth it. The individual SIM cards per country are much more reliable and cheaper. Teslestial in Iraq and Afghanistan, Telecom in Croatia,Vodafphone in Germany and Italy.  Why Apple will not unlock these phones for our military to utilize is incomprehensible to me.  These young men and women are fighting for these Apple people to go to work every day, safe, to live lives they have become accustom to yet releasing a phone to use on another network they can't do at least for the military.... WHY APPLE??  WHY?   A good excuse not some of the many lame excuses I have received on the phone many times. AT&T states it is Apple that will not allow them to unlock the phones...  Please tell me why?  All I want Is my daughter to have a phone I trust, to be able to call me when she is given the free time to do so and I trust the apple phone.
    Apple, please reconsider your stance on this issue.  I am having a hard time understanding why you will not unlock the iPhone. 
    A simple code could allow me to talk to my daughter while fighting for our country the Great USA.  Apple should be on the front line and enabling those fighting for our life, liberty and pursuit of happiness to use unlocked phones on reliable local GSM networks.
    I honestly hope that someone who has some sort of authority to begin allowing the release of unlock codes, and not forcing people to unlock their phones with some program produced by some hack just to be able to use your wonderful phone.  That is is in a nutshell, People love the iPhone so much that they want the ability to use it on the most reliable GSM carrier available to them.  That should be a major compliment. Even men and women on the front line want your phone. I agree, my service is not the best where I live either, love the GSM technology so stay with it, but if I had the ability to change to the other GSM network that has much better coverage in this area of the country I would change. To change now I would not have my iPhone and that I will not part with. 
    Apple, please reconsider opening up the lock code and allow your gem of a phone to be used by many more people in many more areas and most importantly overseas fighting for our country.  I know if this is really thought about Apple would understand and come to the conclusion to release the unlock codes, and stop the people from hacking in to use the iPhone on other networks.
    I would love for my daughter to be able to use my iPhone 3gs while fighting for our Free country.
    A response would be appreciated.
    Thank you.
    An Apple customer for 10 years, phones and computers.
    P

    Defiled:
    I did sign a two year contract and completed that contract. The 3gs is no longer in service. My daughter is going overseas to protect you and your family. I was attempting to find a way for her to have a reliable phone that could offer her some connection with home as she travels through the middle east.  She travels in missions all over.
    At&T unlocks other phones of theirs why not the iPhone?  AT&T says that Apple will not give them the code, it is not the carrier.  If I would have known this situation would have come up I would have bought and unlocked 3gs phone"Deggie" .  My main complaint is that Apple has not good excuse as to why they will not allow their phones to be unlocked from services well, AT&T .  I bought the phone full price, completed the contract terms, even went for and iPhone 4 with another2 year contract, along with owning an apple computer... I love the product.  My main issue is give me a good answer as to why you won't allow a phone to be unlocked. It doesn't hurt Apple, People still have to buy the phones from them, and use their App store and iTunes.
    Sorry, just upset about my daughter heading over there, boots on the ground, and just pray she will be safe. Would have liked to facetime her while she is in the airports and in specific areas allowed for that.
    Please don't come down on me for asking this question. I understand all the contracts etc.... but to single out the iPhone specifically to not unlock after contract is over does not seem fair.
    Thank you for your responses.

  • What is the location for the swatches file in the illustrator product part of Adobe Creative Suite 3 Design Premium for windows (date and lenght)? File that manges its funcionallity.  Thanks

    As per adobe agent chat representative, the following question is posted on the fórum to obtain an answe from adobe.
    What is the location for the swatches file in the illustrator product part of Adobe Creative Suite 3 Design Premium for windows (date and lenght)? File that manges its funcionallity.
    Thanks
    <moved from downloading,installing,setting up - kglad>

    Illustrator is not working as it should...
    I want them to compare the original size and date of creation with what I have installed on my computer... I have installed several times with my original CD and I tried once downloading the files from the adobe site (using my own license). I suspect the files has been modified or renamed on my laptop by an external unauthorized user causing the malfunction of the application. 
    Customer services does not support CS3 anymore and the updates / patches in the adobe site does not solve the problem... They redirect me to the forums for support...
    Presently, my problem is that after creating a swatch and drag it to the swatch panel, it does not fill as it should a new form... Now, after deactivating and activating my license the swatch seems to fill the new form but when the filter that the swatch has is persistence in the next filling object created even though a different color is being used as a fill (X)... Help in the creation of a swatch over the internet just complicate the issue.
    That's why I would like to know whether updates on my product are being received or files are being replaced without my knowledge...
    Thanks...
    PS Do you know how to contact a staff adobe employer on the forums?

  • Hi basically when i try download a app its saying sign in required ask for sercurity code for bank card and i put the correct details in and still saying its invalid? Can anyone help

    Hi basically when i try download a app its saying sign in required ask for sercurity code for bank card and i put the correct details in and still saying its invalid? Can anyone help

    Refusal of a card is based on information provided matching what is on file from your credit card provider. If it is refused, it generally means something is not matching. That can inclue the name, the address or other information. It has to be exact to match. If you check your credit card bill to make sure you are spelling the name correctly, the address is listed correctly, and yes, ST is different than Street, and it still does not work, contact iTunes support. http://www.apple.com/emea/support/itunes/contact.html

  • HT201195 I entered the code for my gift card but I never used it,now I'm trying to use it but it's no there and doesn't let me redeem the code again. What can I do?

    I entered the code for my gift card but I never used it,now I'm trying to use it but it's no there and doesn't let me redeem the code again. What can I do?

    An iTunes gift card can only be redeemed once, you can't enter and redeem its code again. Since you redeemed the card you haven't bought anything (including IAPs and auto-renewing subscriptions), and your account doesn't show a balance ? You've tried logging out and back into your account and seeing if it shows then ?
    My account's balance shows at the top left of the store's page on my computer's iTunes, and by logging in to view my account via the Store > View Account menu option. On my iOS devices it shows at the bottom of, for example, the Featured tab in the App Store app under my account id (or you can view your account via Settings > iTunes & App Stores and it should show on the screen that you are taken to). If the balance is zero then it might not be shown.

  • I have accidentally deleted off my Mac a preferences file for Adobe photoshop and now the program cannot initialize. I have talked to Apple and then say that if Adobe can isolate the file they can help me restore it from my time machine. How do I isolate

    I have accidentally deleted off my Mac a preferences file for Adobe photoshop and now the program cannot initialize. I have talked to Apple and then say that if Adobe can isolate the file they can help me restore it from my time machine. How do I isolate the file ?

    Do you have the path to this file and name of this file?

Maybe you are looking for

  • An Adobe Flash Player message regarding storage has popped up and although I can click "deny", it won;t go away;how do I stop this?

    Whenever this happens, I have been able to click "deny" and it has gone away. However, when trying to play a game on Facebook, it will not go away and allow me to play the game. How do I get rid of this little message? Looks like I'm being hacked as

  • Converting seconds to a date in another language

    Hello all, I am currently working on an application that uses web services to populate a web-based UI.  One of the outputs is a measurement time that is generated using the LabVIEW method 'Get Date/Time in Seconds'.  To make since of this, I convert

  • Loading a second iPod onto same computer

    Hi. Another iPod nano (white 4 gb) has been added to the household and will have to be on the same computer as the already existing one (black 4 gb). When the setup window popped up I hit cancel for right now all I want is to charge it. It asked me t

  • Asset issuance against material in MB1A..

    Hi:             We have decided to witch our old procedure of capitalizing asset through MIGO. Our AS IS and TO BE processed are AS-IS Process: PR--Account assignment category A PO...For asset procured MIGO ...capitalizing the asset TO-BE process: Op

  • MacBook pro will not reboot and seems to be in sleep mode

    I have a MacBook Pro and I had a USB side drive hooked to it and shut down.  When I went to reboot after unplugging usb drive, the Laptop seems to be stuck in sleep mode.  The boot up screen does not appear but the light where you open the screen it