Not able to write to file

Hi all,
I need to upload a file from a J2ME device to a remote server using a servlet
I am uploading an image ..and in the servlet i get the size of the file but i am not able to write to that file...please see code below...any help would be great.
Thanks in advance
StringBuffer bufferBody=new StringBuffer();
          String line="";
          byte[] data = new byte[79872000];
          int cnt=0;
          try
               BufferedReader body=request.getReader();
               while ((line = body.readLine()) != null) {
                    bufferBody.append(line);
                    cnt++;
          data = bufferBody.toString().getBytes();
          System.out.println("data received:"+data+"data length:"+data.length+"lines"+cnt);
          String newFileName = "/home/aztec/pic2.jpg";
          //data="hi".getBytes();
          FileOutputStream imageOutput = new FileOutputStream(new File(newFileName));
          imageOutput.write(data, 0, data.length);
          imageOutput.close();
          System.out.println("Please find image in " + newFileName);
          } catch(Exception ex) {
          System.out.println("Exception: " + ex);
          ex.printStackTrace();
          }

And don't read entire files into memory, especially in a memory-constrained J2ME device. Read and write a 4k chunk at a time.

Similar Messages

  • I'm not able to save any files on an none apple external hard drive, what can i do to make it work?

    I bought a omega 320GB external hard drive so a friend could save the files off an old windows laptop i had but now when i try and open the files on my mac, it doesn't let me. i'm also not able to save any file on to this hard drive either! can some one please help me?

    The drive has the NTFS format, which the Mac OS can read but can't write to. Copy the files from the external drive onto your Mac, then reformat the external drive using Disk Utility, creating a Mac OS Extended volume and using the GUID partition scheme. Then you'll be able to write to the drive. Note that reformatting erases everything from the drive, so don't do it until after you've saved the drive's contents to other media.

  • 107 MB File - was not able to process thru File Adapter

    Hi All,
    I tried to send one 107 MB file using file adapter.
    But was getting error as "not able to write on the integration server".It seemed like XI was not able to process file with that much size...as when we did split up the file into smaller ones ..those were processed....
    I want to know what is the file size limit of File adapter......is there any way to send files with that much size from file adapter?
    Can we do any file sizing exercise on XI servers?
    Thanks.

    Hi Henrique
    Even the Zip Module doesnt help.
    We had a similar case, when Xi was acting as a FTP. We thought we would use the Zip Module, etc but what we realise was even if you plan to use the Zip Module, the Entire File first needs to be loaded into the memory before the module can be called and the chances are that the j2EE stack goes down even before the module can be called.
    We also explored the option of using the Jar command in the command line processing before message processing, even this has the same issue that , the Data is loaded into the memory of the j2ee stack and only then the command is executed and so even though the content was zipped, the actual content used by the file adapter was not the zipped content.
    Regards
    Bhavesh

  • Can we able to write code File transfer protocol code in HTTPServlet file ?

    Can we able to write code File transfer protocol code in Http file ?
    if Yes , give some details about how to write
    if No, give some reason why not .
    Thanks

    Hi Paul(DrClap)
    My question is ,if we are using a java
    file(servlet) which is handing httprequest , can we
    use this to handle FTP request also.As I already said, you can't use a servlet as an FTP server.
    can we able to write FTP code in above mentioned file?As I already politely pointed out, "FTP code" is ambiguous until you specify whether you mean server or client code.
    So. If you don't understand what clients and servers are, then drop this question and go away until you do understand. It's not that complicated.
    And please don't waste my time by responding with the same questions over again.

  • OSB throwing IO Exception : Could not able to rename the file

    Hi, 
    I am trying to publish the file in an SFTP location. OSB is able to write the file with extension .a (which it generally does while writing), but couldn't able rename it to the original name.
    Error From Logs :
    BEA-381801> <Error occured for endpoint com.bea.wli.sb.transports.TransportException: File could not be renamed from: ./OSBSFLFiles/TestFileOSR.xml.a to: ./OSBSFLFiles/TestFileOSR.xml
    com.bea.wli.sb.transports.TransportException: File could not be renamed from: ./OSBSFLFiles/TestFileOSR.xml.a to: ./OSBSFLFiles/TestFileOSR.xml
    Caused By: java.io.IOException: File could not be renamed from: ./OSBSFLFiles/TestFileOSR.xml.a to: ./OSBSFLFiles/TestFileOSR.xml
    Solutions Tried :
    1) All the permissions are there to read and write on that folder.
    2) In the remote SFTP logs there is no activity recorded for attempting to rename the file from OSB.
    Please suggest.
    Thanks,
    Ankit

    Use a JCA adapter.
    Create adapter in Jdeveloper and import the artifacts in to OSB.
    The native support of OSB for SFTP doesn't work sometimes

  • I am not able to email a file from Adobe Reader. When I click to share the file, the option does not pop up to share (via Mail, Message, Air Drop, etc.).

    I am not able to email a file from Adobe Reader. When I click the button to share a file, there is no option for route from which to share (Message, Mail, Air Drop, etc. does not pop up).

    What version of Reader and OS X?

  • PI is not able to pick the file from the FTP folder

    This is the FILE TO IDOC scenario. We have configured the file adapter. But its not able to pick the file from the specified directory. We have tried changing the transfer mode from Binary to Txt & also we have tried to put advance selection for source file but it didn't work. Its throwing the below error:
    PI Adapter Log:
    An error occurred while connecting to the FTP server '10.130.150.21:8529'. The FTP server returned the following error message: 'com.sap.aii.adapter.file.ftp.FTPEx: 451 Unexpected reply coderequested action aborted: local error in processing'. For details, contact your FTP server vendor.
    Also we have contacted the FTP team & they told that PI is sending an unsupported command. So instead of taking the file TLOG.txt, its treating this file name a s a directory. Please find the logs from FTP end below:
    FTP Log:
    (207197)2/5/2013 14:48:25 PM - sysisappi (63.130.82.16)> 230 Logged on
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> FEAT
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> 211-Features:
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  MDTM
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  REST STREAM
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  SIZE
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  MLST type*;size*;modify*;
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  MLSD
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  AUTH SSL
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  AUTH TLS
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  PROT
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  PBSZ
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  UTF8
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  CLNT
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)>  MFMT
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> 211 End
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> PBSZ 0
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> 200 PBSZ=0
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> PROT P
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> 200 Protection level set to P
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> CWD /Qas
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> 250 CWD successful. "/Qas" is current directory.
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> CWD SAP_ORION
    (207197)2/5/2013 14:48:26 PM - sysisappi (63.130.82.16)> 250 CWD successful. "/Qas/SAP_ORION" is current directory.
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> CWD Inbound
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> 250 CWD successful. "/Qas/SAP_ORION/Inbound" is current directory.
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> CWD IRIIN04
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> 250 CWD successful. "/Qas/SAP_ORION/Inbound/IRIIN04" is current directory.
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> CWD TLOG.txt
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> 550 CWD failed. "/Qas/SAP_ORION/Inbound/IRIIN04/TLOG.txt": directory not found.
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> QUIT
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> 221 Goodbye
    It should list  *TLOG.txt*  but instead it is trying to get into a directory named  *TLOG.txt*.  same for other interface.
    So me & my team is struggling for last couple of days to fix this issue.Please share your suggestion

    Hi Sisir
    The screen shot of your config doesn't seem to correspond to the FTP log. I say this because the * is dropped from file name pattern "*TLOG.txt" (comparing your config and the FTP log). Can you share an updated FTP log?
    Sisir Das wrote:
    "/Qas/SAP_ORION/Inbound/IRIIN04" is current directory.
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> CWD TLOG.txt
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> 550 CWD failed. "/Qas/SAP_ORION/Inbound/IRIIN04/TLOG.txt": directory not found.
    (207197)2/5/2013 14:48:27 PM - sysisappi (63.130.82.16)> QUIT
    Also, like Rajesh suggested, have you tried to manually check permissions by logging in, traversing the directory, and getting the file?
    By the way, we always use backslash \ instead of forward slash in our configs. Not sure this would make any difference for you though. Also, I don't normally use a trailing \ at the end of the source directory path.

  • I'm not able to open PDF files in Adobe Reader XI.

    I recently updated to Adobe Reader XI and now I can't open any of my PDF documents or PDF e-mail attachments.  When I click on a document I now get a window that asks if I want to allow this file to open.  I click yes and get a monstrousity the likes I've never seen.  It blacks out my screen for a couple seconds and then I get a mixture of my desktop, task bar, and a window wanting to know if I want to open this with Protected Mode disabled.  It only fills 3/4 of the screen, the items all all blown-up in size, and are distorted.  In playing with this I have gotten notes that I have an "Incompatable Application" and "Acrobat failed to connect to a DDS Server".  On occasion I will get an Adobe Reader screen that is completely greyed out with no content in it and after a couple of seconds it goes off.  Other times I got the window about Protected Mode and I've clicked on to disable it but that doesn't work either.  I removed Adobe Reader XI and re-installed Adobe Reader X and I still have the same problem which I did not have before.  I 'm running Windows 7 Professional and have McAfee anti-virus, which I have disbled on one occasion during download and that I still had the same problem.  I went to program files to find the End User License Agreement and try to see if I needed to click on 'Accept" but it tells me the file does not exist.  I even tried using System Restore to take me back to before I did the upgrade to Adobe Reader XI and I still have this problem.  I'm at the end of my knowledge level and because these files are needed in my business I'm only able to operate at about 50%. 

    From: Test Screen Name [email protected]
    Sent: Sunday, August 04, 2013 11:32 AM
    To: gunner0490
    Subject: I'm not able to open PDF files in Adobe Reader XI.
    Re: I'm not able to open PDF files in Adobe Reader XI.
    created by Test Screen Name <http://forums.adobe.com/people/TestScreenName>  in Adobe Reader - View the full discussion <http://forums.adobe.com/message/5565198#5565198

  • Not able to open XML file in the application server..........

    Hi,
    I have downloaded a XML file to the application server.....
    File is created but i am not able to open the file there....
    Plz advice ....how to open it.....
    Regards.

    Use Notepad. Drag and drop in notepad.
    Aman

  • Not able to convert word file to PDF using Adobe Acrobat 9 Standard

    Hi,
    I am not able to convert word file to PDF using Adobe Acrobat 9 Standard. When I try to convert, it starts the process and in between I am getting this prompt, as shown in figure below and the conversion process stops. The PDF is not created.
    Note: The filename 'Acr85.doc' in the above prompt keeps changing and is random.
    I tried clicking Yes, No and Cancel on the above prompt, but the conversion process just stops and PDF is not getting generated.
    I am able to create PDFs from web pages. No issues with that. Not working only with Word.
    Can someone help me with this.
    Thanks,
    Vinay Jaassiel Kankipati
    Technical Writer

    In MSWord please changes the settings as "Adobe PDF" menu => "Change Conversion Settings" goto Tab Bookmark and clicks the option Convert Word Bookmarks. Now you convert the Doc to PDF you can achieve the Bookmark.
    Hope this help you
    Sudhakar

  • HT3678 If I download a .mov file from gmail, I am not able to open the file. I reinstalled QuickTime 7.6.6, still unable to open the file. If I download the same file from another mail server I have no trouble. What is gmail doing to my file?

    If I download a .mov file from gmail, I am not able to open the file. I reinstalled QuickTime 7.6.6, still unable to open the file. If I download the same file from another mail server I have no trouble. What is gmail doing to my file?

    Also i have reinstalled the reader9 two  times and tried with reader8 also but in both the cases same problem.
    it would be gr8 help if someone can help.

  • My software is STUCK on "Retrieving current session status" What is this and how do I fix it? i am not able to convert any files at all!! Please help!

    My software is STUCK on "Retrieving current session status" What is this and how do I fix it? i am not able to convert any files at all!! Please help!

    Hi JulietaQ,
    In order to help you better.
    Please let me know which application or Service of Adobe you are using. If this is subscription i would request you to log-out and log-in back and let me know if that helps.
    ~Ajlan Huda

  • I am not able to delete my files.

    I am not able to delete my files. When I delete file It ask me for password, and then It delete from system but hard does not show any free space that must be created when I delete some file. Please help me.

    After deleting ,no data is going trash.
    I am getting this problem from 3 three days. Rebooting system is not working. It seems like that when I delete file its move to some other location.
    If it is security feature then please tell me how can I change it?

  • I am not able to open my file! Captivate 5

    I don’t know who else to send this to right now, but I have been working on a project that is DUE.  I am not sure why, but I am not able to open the file.  Please help me are direct me to someone that can.
    Here's the error message received:
    Adobe Captivate could not open, "file name" Ensure that:
    File is not open already
    File is not damaged
    The hard disk has enough space
    Close all windows
    I need this file open asap. 
    And yes...I cleared the Cache

    Hello,
    This is by design: I failed to explain well. The file exists as long as the file is open, sort of protection that it is not changed by someone else. It will disappear when you close the file. But the first error message at your originial question pointed perhaps to the fact that the file was not closed in a normal way, hence the lock file was perhaps still there. If you deleted the lock file you could have opened the file again, it was no longer protected. Hope my explanation is now a bit clear?
    Lilybiri

  • HT204406 I am not able to download my files from iCloud to my iPad using iTunes Match, my internet connection is alive as I tested with Safari, I have enabled iTunes Match on and off to be usre is active..but still  cannot download....my music

    I am not able to download my files from iCloud to my iPad using iTunes Match, my internet connection is alive as I tested with Safari, I have enabled iTunes Match on and off to be usre is active..but still  cannot download....my music

    I have the same problem on my Windows 7 computer. In the right-click menu for a song one option is DELETE. However when I click that option the next window is to HIDE instead of DELETE. Apple, please help us with this.

Maybe you are looking for

  • SQL query, Decode function or Case

    Hi, I am writing a procedure, receiving IN parameter p_user_type_cd where p_user_type possibles values are = 'STUDENT','STAFF','PROVIDER' if p_user_type_cd = 'STUDENT' , I would like to select WHERE user_type_cd = 'STUDENT' if p_user_type_cd = 'ALL'

  • How can I remove icons from the menu bar?

    Help tells me to hold down the command key and drag the icon off the bar. But all that happens is that a dropdown menu appears which lists various actions which can be performed by the application. None of the actions listed include deleting the icon

  • How do I read data from a DMM or DC Power Supply at a specified rate?

    I have a PXI system with 4071 DMMs and 4110 DC Power Supplies. I want to be able to measure the power consumption of my DUT as it performs various operations. This is what my process flow looks like: 1. Configure DMM and Power Supply  2. Wait for DUT

  • Error "Licensing for this product has stopped working" when starting Adobe Photoshop CS3 Extended- XP Pro AMD; 2GB RAM

    I have exhausted all known options thus far. I started the Flexnet Licensing Service and restarted the system but the message continues to come up when lanching PS CS3 extended After restarting computer the Flexnet  Licensing Service stops again and

  • Searching for a Script...

    I am in the process of making a "Deal or No Deal" type DVD program in DVDSP. I am going to rig it (i.e. the third briefcase has $500 regardless of the case's number) The problem I am running into is that I'm not sure how to "turn off" a case after it