Appending a "\n" to a file created.

I am reading database column values and writing it to a file.
I want to add a "\n" after each line is read,but even if I
append a "\n" to the file,the file output comes all on
the same line.
How do I add the "\n" to the values read so that the output looks like
RDB,234567,4567
LON,345677,8970
EUR,456880,9833This is my code :
try {
           FileWriter fWrite  = new FileWriter("/JavaWorks/OS1.txt",true);
           for ( int i = 0; i < rowCount; i++ ) {
               Object entity =  stm_OS.getValueAt(i, stm_OS.getColumnIndex("id_entity"));
               Object ca     =  stm_OS.getValueAt(i, stm_OS.getColumnIndex("id_ca"));
               Object inst   =  stm_OS.getValueAt(i, stm_OS.getColumnIndex("id_inst"));
             String source = entity .toString()+ ","  +
                             ca.toString()     + ","  +
                             inst.toString()   + ","  + "\n";  // putting "\n" here doesnt help.
              char buffer[] = new char[source.length()];
              source.getChars(0,source.length(),buffer,0);
              for(int b=0; b<buffer.length; b++){
                fWrite.write(buffer);
}catch(Exception e){}

Hi,
No luck with using PrintWriter to append a "\n"..
Any suggestions?
try {
       FileWriter fWrite2  = new FileWriter("/JavaWorks/OS2.txt",true);
       PrintWriter pWriter = new PrintWriter(fWrite2);
           for ( int i = 0; i < rowCount; i++ ) {
               Object entity =  stm_OS.getValueAt(i, stm_OS.getColumnIndex("id_entity"));
              Object ca     =  stm_OS.getValueAt(i, stm_OS.getColumnIndex("id_ca"));
              Object inst   =  stm_OS.getValueAt(i, stm_OS.getColumnIndex("id_inst"));
           String source = entity .toString()+ ","  +
                           ca.toString()     + ","  +
                       inst.toString()   + ","  ;
                 char buffer[] = new char[source.length()];
           source.getChars(0,source.length(),buffer,0);
              for(int b=0; b<buffer.length; b++){
                     pWriter.write(buffer);
               pWriter.write("\n");
}catch(Exception e){}

Similar Messages

  • Appending date and time to file created in UTL_FILE

    I am trying to create a log file of database (9i) updates using PL/SQL code and I am able to create a file using UTL_FILE utility and in file name I give name as 'log-'||sysdate||'.txt' and it successfully cerates log-22-NOV-05.txt file.
    My problem is adding time to it. I declared a varibale ws_var1 and capture time in it by below statement.
    select to_char(sysdate,"HH24:MM:SS') into ws_var from dual.
    SO when I try to add this to file name as 'log-'||sysdate||'-'||ws_var1||'.txt' the file that gets created is just two number such as 02.txt, 34.txt etc.
    I am not sure where the problem is but any help to create file name with date+time information is apperciated.
    Thx

    Why not just:
    'log-'||TO_CHAR(sysdate, 'DD-MON-YYYY-HH24MISS')||'.txt'
    SQL> select 'log-'||TO_CHAR(sysdate, 'DD-MON-YYYY-HH24MISS')||'.txt' from dual ;
    'LOG-'||TO_CHAR(SYSDATE,'D
    log-22-NOV-2005-170813.txt
    1 row selected.
    SQL>

  • I have nine, 1-page PDF files that are accessible and need to combine into 1 PDF file.  I have tried appending, adding and the combine PDFs process. The file created is not keeping my changes. The created file is partially accessible but I have to re-fix

    I have nine, 1-page PDF files that are accessible and need to combine into 1 PDF file.  I have tried appending, adding and the combine PDFs process. The file created is not keeping my changes. The created file is partially accessible but I have to re-fix issues I had fixed in the single files. I need suggestions on what else can be done if any. Using Acrobat pro XI.

    Out of habit, I tend to combine PDF files in the Page Thumbnails pane by right-click then "Insert Pages" -> "From File". For me, this preserves the tags from both documents, although the tags may have to be moved into the right location (if I recall correctly the tags for the inserted pages get put at the end of the tag structure, regardless of where the pages are inserted), If I first put the tags for the document to be inserted inside a container tag like Section, it makes the process easier. Moving that set of tags to the right place is the only re-fixing that I recall having to do. What behavior are you experiencing?
    a 'C' student

  • XLS Files created by SSRS will not open in Numbers on the iPad

    The company I work for creates business intelligence reports which are used in an education environment and are created daily and e-mailed out to staff.  These reports contain fairly simple tables with pupil data.
    One customer uses iPads extensively to maximise the quick response to this (behaviour) data.  There is an issue which seems to be prevalent in newer versions of Numbers where these documents can not be opened.  I note a previous discussion on this matter where the only solution was to save the file in excel and then the sheets would open.  This is not really an option here.
    I presume that there is some data missing in the header of the XLS file or something but if anyone has any information on this, especially if I can adapt the report in any way to include this data, please let me know if you have overcome a similar issue and how you went about it.
    Thanks,
    Pete H

    Hi - thank you for your responses.  I don't have an iPad so testing is all being done on site.
    The report is based on three tabs, each producing a basic table with data in.  I can create the reports in CSV and they work fine although the format is all wrong (no tabs etc etc) - but that would lead me to believe that it is nothing in the actual data which is causing the load error.  It also seems fairly intermittent, so I tested with a few different file sizes to make sure it wasn't this - and again nothing too conclusive there.
    I presume quicklook is the built in function to view a file, I spotted this today but again it won't open in that or then again when asked to open in Numbers.
    Hunting around this forum it seems there is some issue in general with opening some XLS files (especially ones created by SSRS) depending on iOS version, so that is the route I will be looking at tomorrow.  Putting these files through a save loop in excel isn't really an option, so I am going to test with a go between e-mail tomorrow which has in some cases seemed to do the trick - maybe appending something to the original file.  Some other posts have suggested that an XLSX file seems to work a lot better and that is supported in MS SQL 2012 which is on the way for our customers at some point.
    Definitely an awkward one!
    Thanks,
    Pete

  • Append data to a existing file thru ALSB Service

    Hi,
    I want to write/append message data to a file before and after I invoke a Business Service.
    I have created a Business Service with Service Type as Messaging Service and the protocol as FILE. I notice that everytime I call the Business Services a new text file is created. Is there a way I can append messages to the same file.
    The workaround I thought of is to write a Java Class to write/append data to a file and invoke this as a Java Callout. Is this a feasible/good solution.
    If anybody has any ideas of implementing this, please help.
    Thank you.

    This feature is not supported by ALSB
    You are correct, your best bet is to write some code in a Java callout to implement your expected behavior.
    Gregory Haardt
    ALSB Prg. Manager
    [email protected]

  • How to append datas to a text file?

    Hi,
    I want to append the data to a already created text file.When i used Write to text file.vi. It overwrites the previous data.
    Solved!
    Go to Solution.

    Try using the 'set file position' function (file io palette, advanced functions)  before you write the data.
    i.e. open the file, set position to end, write the data, close the file.
    Ian

  • How to append to a signed PDF file

    We have Adobe Acrobat 8.1 Professional on PCs running Vista.
    In the past, we could append a scanned document to a PDF document that has already been signed using a self-created Adobe digital signature.  Now we have docs with a digital signature from a Certificate Authority.  I can no longer append a scanned doc to the signed PDF file.  Is there a way to do this?  Previously, we selected Create PDF > From Scanner > selected Append > and clicked Scan.  The scanned paper file would be added to the existing signed PDF document.  Now, however, we get the message "File can't be appended" when we select Append and navigate to the file signed with a digital signature from a Certificate Authority.  One more factor, the documents we get are now signed with PDF signing software other than Adobe Acrobat.  I tried scanning the doc to a file and then combining and Adobe Acrobat would not allow that either because of the digital signature.  Does anyone know how to do the append procedure now?
    Thanks!

    Click on the "arrow out of box" icon on the menu when you're viewing your PDF document (2nd button from right). then click "E-mail document".

  • Unable to see the logical path and file created in FILE tcode from AL11 and unable to upload the file to this path from front end

    Hi Experts,
    I have created the logical path and filename in FILE tcode.I am trying to upload the pdf file to application server by using this path.But
    I am getting message like "Unable to open the file".Even I cannot find the this path in AL11 tcode.Kindly anyone advise how to upload pdf file using
    custom path and file created from FILE tcode.
    Thanks & Regards,
    Anusha.

    Hi Anusha,
    Please give as below.
    I forget to say you cannot open the PDF in AL11 and for that you need some configuration, i think it can be done using content server,not sure completely please wait for some more suggestions.
    Regards,
    Pavan

  • Does the online function cater for a PDF file created in version 9 to be converted to version 6

    I am running Win98SE on one computer (A) and WindowsXP on another computer (B).
    On Computer A I am running Adobe Reader 6.06.
    On Computer B I am running Adobe Reader 9
    Is there a methodology (presumably outside of Adobe Reader) to convert a version 9 file to a version 6 file so that it can be opened in Computer A?
    Microsoft Office Word/Excel for example allows files created in current versions of Office to be opened in the current version and saved as an earlier version.
    Does one have to buy the full Adobe Acrobat package to get a similar function?

    No. Reader is just that a reader of pdf files. You would need Acrobat Standard or Pro to change a file to be read by an earlier version.

  • I received a psd file created in CS6 for MAC, I am unable to find the layers when I open it in photoshop in Windows. What can i do to edit the files?

    I received a psd file created in CS6 for MAC, I am unable to find the layers when I open it in photoshop in Windows. What can i do to edit the files? What can be done so that I can either open and see the layers or how can the sender save it in a way that it doesn't "merge" the layers in some way to just one?

    Could try saving as tiff provided layers and transparency are chosen at the time of saving. But it's hard to give a definitive answer as it depends on the final usage. For example PSD's tend to work better in applications like In Design in comparison with tiff.

  • Opening '.doc' files created by Appleworks

    Hi,I couldn't find any discussion of this so am posting a question.
    Pages 2.0 opens all our normal Appleworks word processor (cwk?) files OK, and also opens "real" ".doc" files created by Word (from others, we don't have Word).
    Pages won't open Word type ".doc" files saved from Appleworks, and gives a message that it is an incorrect file type. If I use "get info" to remove the .doc extension from the name, Pages will open the renamed file. So pages appears to be okay opening Appleworks saved .doc files only if I remove the .doc from the name.
    Kind of hard to do with several hundred files. Any suggestions?
    G42x800, G4Cube, Etc. Mac OS X (10.4.5)

    I don't know what the problem is exactly. When I save a document as Word (6 or 98) in AW, no .doc extension is added to the file name. But here is a solution to remove the extension, if that helps:
    Create a workflow in Automator. I use Automator on a german OS, I have tried to translate the commands, but you might have to search for the corresponding actions with a similar name.
    - Add the "Get Folder Content" action
    - Add the "Rename" Finder action
    - Select "Replace text" and replace ".doc" with nothing or with "AW doc"
    Then save the action as a folder plugin and attach it to a "Convert AW docs" folder.
    Any file dropped into the folder will be renamed according to your rules.

  • Address Book -- Importing CSV File created by Numbers

    I'm trying to import a csv file generated from MS outlook into address book. When I attempt to import the csv file that Outlook created, Address Book is able to recognize the file. However, I need to modify the file before importing. To do that, I opened in Numbers, deleted some columns and renamed some columns. Then, I exported from Numbers as a .CSV file. However, when I try to import the .CSV file created by numbers, I get the error that I have modified with Numbers, I get the error "Text file import failure".
    Does anybody know why address book can't import a CSV file created by Numbers?

    Many people have run into this problem, including myself. I had worked many hours on a spreadsheet in Numbers, exported to CSV, and received the error message when trying to import into Address Book. The answers to this dilemma are out there, but tidbits of the whole answer are spread around discussion boards. So I hope to consolidate those answers here.
    The main problem for me -- and it's reasonable to assume that others receive the "Text File import error" for the same reason -- is that 1) I had commas in my spreadsheet, and 2) I had hidden RETURNs in the spreadsheet. Once I got rid of those two things, I had no problem importing into Address Book.
    Deleting Commas>
    The problem with commas in your spreadsheet is that the CSV format uses commas to distinguish when a new cell is formed. So having other commas will inevitably confuse Address Book during the attempted import. I didn't have too many commas in my spreadsheet, so I was able to quickly remove them. Yet, if you have dozens or hundreds of cells with commas in them, you'll need an easier solution. I imagine opening Number's Inspector>Cell Inspector>Format will have the solution of removing commas from, say, currency amounts or something else. Yet, how many commas arise in contact information? Perhaps the easiest way is to use the same method of removing those hidden RETURNs. Read on...
    Deleting Hidden RETURNs>
    You can't see them, and I couldn't find a "show invisibles" option in Numbers. So you need to search and find them. Yet, how do you search for something hidden? Do the Command-F thing to bring up the search field. The search bar should automatically be ready to search what you type. Hitting the Return key will do nothing for you, but hitting Shift-Option-Return will (you'll likely need to hit Return again to actually perform the search). Numbers will point out how many times these hidden returns are in your spreadsheet, which cells contain them, and give you the option to automatically replace them with something else (a space is a safe option). You can do the same search and replace with commas too.
    Save your spreadsheet, export it as CSV, and -- as long as the only errors stemmed from commas and hidden RETURNs -- you shouldn't have a problem having Address Book import it. Good luck!
    PS- After importing my spreadsheet, I noticed that some of my Smart Groups in Address Book were not showing some people who should have automatically been in there. The problem was that the Smart Group search had straight apostrophes in it, but the imported contact had curved apostrophes. The computer saw these as two unrelated characters. After some copying and pasting, the problem was solved.

  • Pdf file created in Word 2008 will not open in Acrobat 8.2.6 or any other Adobe program

    I have created a 12 page newsletter in Microsoft Word Publisher 2008 and have done so many times before with no problem. Today, I have tried to save it as a .pdf file both in Save As and through the printer. Each .pdf file created in Word will not open in Acrobat 8.2.6, Photoshop C3, Adobe Reader  nor any other Adobe software.
    When I go to open it in Acrobat, my Mac gives me the spinning rainbow. If I try to click on the file, I get a watch and then Acrobat crashes or I have to force quit the software. I really need to convert this file and get it to the printer. Any advice???
    Mac OS X 10.6.7
    Word 08 12.2.8
    Acrobat 8.2.6
    Adobe Reader 10.0.0

    Here is a better example.
    https://www.calcerts.com/PBR1.pdf
    is the original PDF file that is uploaded by a user.  Note that it is only 48kb in size.
    I take the file, add a couple of watermarks and a footer for each page as well as a small image on the last page, add security on it and BAM, the file:
    https://www.calcerts.com/PBR1_AFTER.pdf
    is now 1.5 MB and it takes a LONG time to print.
    Thoughts?

  • How to read data from multiple files and append in columns in one file

    Hi Guys,
    I have a problem in appending data from files in different columns. I have attachement has file A and B which I am reading and not able to get data as in file Result.txt. Please comment on how can I do this
    Solved!
    Go to Solution.
    Attachments:
    Write to file.vi ‏13 KB
    A.txt.txt ‏1 KB
    B.txt.txt ‏1 KB

    You cannot append columns to an existing file. Since the data is arrange line-by-line as one long linear string in the file, you can only append rows. A new row needs to be interlaced into the original file, shifting everything else. If you want to append rows, you need to build the entire output structure in memory and then write all at once.
    (I also don't think you need to set the file positions, it will be remembered from the last write operation.)
    Unless the files are gigantic, here's what I would do:
    (Also note that some of your rows have an extra tab at the end. If this is normal, you need a little bit more code to strop out empty columns. I include cleaned up files in the attachment. I also would not call them A.txt.txt etc. A plain A.txt is probably sufficient.)
    EDIT: It seems Dennis's solution is similar )
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Write to fileMOD.zip ‏6 KB
    MergeColumns.png ‏6 KB

  • How To Delete .mov file Created In Quick Time

    How do I delete an audio file created in Quick Time Player and saved in my Movies folder as a .mov file? I can't drag it to Trash, and I can't access the delete option in the Edit dropdown, and Help doesn't seem to cover that topic. It just puts the floating blue marker beside Select All, which seems to do nothing much.
    Many thanks.

    Right click (Control click) and choose Move to Trash.

Maybe you are looking for

  • Overclocking the z77a-gd65 board

    Hello my new found friends (I hope).I am new to both these forums and overclocking but I'm willing to learn. I have a msi z77a-gd65 mobo, 32 gigs crucial memory with an i7 3770k cpu rated at 3.5 GHz. I also have a corsair H80i cpu liquid cpu cooler. 

  • Need some help in Los Angeles

    working on a music video that needs some help. I own Final Cut and Color. Done the edit and it looks great but it needs help polishing and I have no idea what to do. Planning on showing the video this friday night in hollywood and I want it to blow p

  • SAP Note#350011 - To measure CPU performance for BPS applications

    Hello, I am Implementing SAP note 350011 in 2004s BW system (SP13). I have executed the 3 scripts using UPS_BENCHMARK_EXECUTE. But I am not able to get the reference values to compare the result. Please let me know, from where will I be able to get t

  • Audio source for queue music. Source from Audio server?

    UCCX 7.2  express enhanced Can I some how source my wav file from a server or from Call Manager. The issue I am having is I have my wav files that are split inot 1 minute increments so I can count how many minutes it is and run a IF statement to play

  • 'TAB'bing into an Array

    One of our developers has just run across a limitation in Forte' that you cannot 'TAB' into an array. He was trying to set the 'Next Tab Field' property to a field within an array. Has anyone else encountered this? Is there a work-around? Any help wo