Problem displaying CLOB in text file

Hello All,
I have a problem displaying the content from the database in notepad. When I click on a link on my jsf screen, I retrieve the data and display it in notepad.
I have my text content stored in the database with CLOB datatype. When I look in the database the data looks in the following format:
---------STARTS FROM NEXT LINE-------------
The firm, known for its keen oversight of products, has been the subject of complaints from firms who have had apps blocked from the store. Some developers have complained that the company's rules seem inconsistent.
Some have found apps blocked after seemingly minor updates, or for having content deemed inappropriate by them. In light of this, and after careful consideration, I believe it is unnecessary to sign this measure at this time.
Sincerely,
ABC
----------ENDS IN THE PREVIOUS LINE------------
Now when I display this content onto the notepad, all the spaces and new line characters are lost, and the entire display looks awkward. This is how it looks:
The firm, known for its keen oversight of products, has been the subject of complaints from firms who have had apps blocked from the store. Some developers have complained that the company's rules seem inconsistent.[]Some have found apps blocked after seemingly minor updates, or for having content deemed inappropriate by them. In light of this, and after careful consideration, I believe it is unnecessary to sign this measure at this time.[]Sincerely,[]ABC
All the new line characters are lost and it just puts some junk character in place of a new line.
When I copy the same text onto textpad, everything is alright and it displays exactly the way it is present in the database. I am also open to display the content in html, but in HTML it doesn't even display me the junk character in place of new line. It is just one single string without any line separators.
I am using the following code to put the content into the text.
public String writeMessage(){
   OutputStream outStream = null;
   HttpServletResponse response = getServletResponseFromFacesContext();
   Reader data = null;
   Writer writer = null;
   try{
      response.reset();
      response.setContentType("text/plain; charset=UTF-8");
      response.setHeader("Content-Disposition","attachment; filename="+id+"_Message.txt");
      outStream = response.getOutputStream();
      QueryRemote remote = serviceLocator.getQueriessEJB();
      data = remote.retrieveGovernorsVetoMessage(billId);
      writer = new BufferedWriter(new OutputStreamWriter( outStream, "UTF-8" ) );
      int charsRead;
      char[] cbuf = new char[1024];
      while ((charsRead = data.read(cbuf)) != -1) {
         System.out.println(charsRead);
      writer.write(cbuf, 0, charsRead);
      writer.flush();
   }catch(Exception ex){
      ex.printStackTrace();
   }finally{
      //Close outStream, data, writer
      facesContext.responseComplete();
   return null;
}Any help or hints on resolving this issue would be highly appreciated.
Thanks.

The data is imported from a third party application to my database. It doesn't display any newline characters when I view the data.
But when I do a regular expression search on text pad, I could see that my clob contains \n as the new line character. Is there a way to replace \n with \n\r while writing the data.
Thanks.

Similar Messages

  • Displaying of a text file using JAVA in a browser.

    Please can you give me the code for displaying of a text file using a bean and java coding. Please include all files needed. Thanks

    please could you give us 200 Uss each for the work done for you plz include all needed recipes plz? thx

  • How to display data in text file in column format

    hi
    i am acquiring data from an oscilloscope.
    wen i save the data in a text file using wite to speadsheet string, all the voltage values r displayed first and then the time values... besides its tab delimited
    how can i display it such that the time values r in one column and the voltyage values r in the other column
    thanx
    Solved!
    Go to Solution.

    Hi,
    I think you are collecting data at the same time and as aeastet told building an array will help. the example attached will give you an idea.. Though i am not sure whether this will solve your problem or not.
    Regards,
    Nitzz
    (Kudos are always Welcome, Mark as a solution if it is the One)
    Attachments:
    Untitled 1.vi ‏7 KB

  • Problem displaying Word 2002 RTF files in JEditorPane

    Hi all,
    I am having a problem displaying RTF files created in Word 2002/Office XP in a JEditorPane.
    Our code, which does the usual stuff:
    JEditorPane uiViewNarrativeEda = new JEditorPane();
    uiViewNarrativeEda.setContentType(new RTFEditorKit().getContentType());
    FileInputStream inDocument = new FileInputStream("c:/temp/testing.rtf"); uiViewNarrativeEda.read(inDocument, "");
    inDocument.close();
    works just FINE with RTF files created in Word 97, WordPad etc, but it seems that Word 2002 adds some tags to the RTF file that the RTFReader cannot handle.
    For example, I believe the following exception is due to the new \stylesheet section that Word 2002 adds to the RTF file:
    java.lang.NullPointerException:
         at javax.swing.text.rtf.RTFReader$StylesheetDestination$StyleDefiningDestination.close(RTFReader.java:924)
         at javax.swing.text.rtf.RTFReader.setRTFDestination(RTFReader.java:254)
         at javax.swing.text.rtf.RTFReader.handleKeyword(RTFReader.java:484)
         at javax.swing.text.rtf.RTFParser.write(RTFParser.java, Compiled Code)
         at javax.swing.text.rtf.AbstractFilter.readFromReader(AbstractFilter.java:111)
         at javax.swing.text.rtf.RTFEditorKit.read(RTFEditorKit.java:129)
         at javax.swing.text.JTextComponent.read(JTextComponent.java:1326)
         at javax.swing.JEditorPane.read(JEditorPane.java:387)
    Does anyone have similar problems or knows how I could get around this?
    I thought about writing a parser that replaces the \stylesheet section with one that works but that seems a lot of work and it does not always work (I tried that by copying and pasting...).
    Maybe I could replace the RTF converter that Word 2002 is using with another one - but how?

    Hello again,
    I found out that the 2002 version of MS Word writes a lot more of data into the file than e.g. Wordpad does.
    There is one section that causes the problem, its called "\stylesheet".
    My workaround (working in my case) is to wrap the input stream of the RTF document and remove this section (only in memory).
    See example implementation:
    <<<<<<<<<<<<<<<<<<<<<<< SOURCE CODE<<<<<<<<<<<<<
    * Copyright 2004 DaimlerChrysler TSS.
    * All Rights Reserved.
    * Last Change $Author: wiedenmann $
    * At $Date: 2004/03/31 11:08:54CEST $.
    package com.dcx.tss.swing;
    import java.io.*;
    * This class provides a workaround for parse errors in the
    * {@link javax.swing.text.rtf.RTFEditorKit}. These errors are caused
    * by new format specification for RichTextFormat (RTF V1.7).<br>
    * <br>
    * The workaround is to filter out a section of the RFT document
    * which causes an exception during parsing it. This section has no
    * impact on the display of the document, it just contains some
    * meta information used by MS Word 2002.<br>
    * The whole document will be loaded into memory and then the section
    * will be deleted in memory, there is no affect to the document
    * directly (on file system).<br>
    * <br>
    * <i>This workaround is provided without any warranty of completely solving
    * the problem.</i>
    * @version $Revision: 1.1 $
    * @author Wiedenmann
    public class RtfInputStream extends FilterReader {
    /** Search string for start of the section. */
    private static final String SEC_START = "{\\stylesheet";
    /** Search string for end of the section. */
    private static final String SEC_END = "}}";
    /** Locale store for the document data. */
    private final StringBuffer strBuf = new StringBuffer();
    * Wrapper for the input stream used by the RTF parser.<br>
    * Here the complete document will be loaded into a string buffer
    * and the section causes the problems will be deleted.<br>
    * <br>
    * @param in Stream reader for the document (e.g. {@link FileReader}).
    * @throws IOException in case of I/O errors during document loading.
    public RtfInputStream( final Reader in ) throws IOException {
    super( in );
    int numchars;
    final char[] tmpbuf = new char[2048];
    // read the whole document into StringBuffer
    do {
    numchars = in.read( tmpbuf, 0, tmpbuf.length );
    if ( numchars != -1 ) {
    strBuf.append( tmpbuf, 0, numchars );
    } while ( numchars != -1 );
    // finally delete the problem making section
    deleteStylesheet();
    * Deletion of the prblematic section.
    private void deleteStylesheet() {
    // find start of the section
    final int start = strBuf.indexOf( SEC_START );
    if ( start == -1 ) {
    // section not contained, so just return ...
    return;
    // find end of section
    final int end = strBuf.indexOf( SEC_END, start );
    // delete section
    strBuf.delete( start, end + 2 );
    * Read characters into a portion of an array.<br>
    * The data given back will be provided from local StringBuffer
    * which contains the whole document.
    * @param buf Destination buffer.
    * @param off Offset at which to start storing characters -
    * <srong>NOT RECOGNIZED HERE.</strong>.
    * @param len Maximum number of characters to read.
    * @return The number of characters read, or -1 if the end of the
    * stream has been reached
    * @exception IOException If an I/O error occurs
    public int read( final char[] buf, final int off, final int len ) throws IOException {
    if ( strBuf.length() == 0 ) {
    // if buffer is empty end of document is reached
    return -1;
    // fill destination array
    int byteCount = 0;
    for (; byteCount < len; byteCount++) {
    if ( byteCount == strBuf.length() ) {
    // end reached, stop filling
    break;
    // copy data to destination array
    buf[byteCount] = strBuf.charAt( byteCount );
    // delete to copied data from local store
    strBuf.delete( 0, byteCount + 1 );
    return byteCount;
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Integration of the warpper looks like:
    RtfInputStream inDocument = new RtfInputStream( new FileReader("test.rtf"));
    Document doc = rtf.createDefaultDocument();
    rtf.read(inDocument, doc, 0 );
    Hope this helps - for me it did :-)
    Timo Wiedenmann
    DaimlerChrysler TSS, Germany

  • Display tokens in text file

    Hello All;
    I am working on some text file update VI's, and I am having quite a bit of trouble with tokens...
    In order to get all my offsets and such correct, I need to input a text file (using Read From Text File), but I want to display all tokens with the text. I've played around with the Scan String for Tokens VI, but cannot get it to do what I want it to.
    I am attaching a sample text file.  Is there a quick way of doing this?  (i.e. read from file, put into string, scan entire string and output same string with both text and tokens visible)...
    Thanks.
    D. J. Hanna
    Attachments:
    Default.txt ‏1 KB

    Hi Hannamon,
    then you shouldn't attach a text file that definitely looks like an ini-file
    When you can't use the config file functions you have to program all their possibilieties on your own
    Well, I would try to use the string functions (like Scan from string, Match pattern, Spreadsheet string to array,...).
    See the attachment to get a clue.
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    ParseString_LV71.vi ‏41 KB

  • Problem displaying dynamically loaded text in Flash CS3

    I created a Flash CS3 application that does not display
    dynamically loaded text (from internal AS3 scripts) on 3/6 of my
    client's computers. All computers run IE 6 and Flash Player 9. I
    cannot replicate the problem on any computer in my department. The
    problem seems to be related to Flash Player 9 or a browser
    setting/IT restriction. Has anyone encountered this? If so, have
    you found a solution?
    If I cannot find a solution, then I will need to almost
    completely redo the application.
    One slightly insane idea I have considered is to, if
    possible, convert dynamically loaded text to an image real-time. Is
    that possible?
    Btw, I have created a font in my library. Should I try
    manually embedding the font from the Properties menu and selecting
    all characters?
    Thanks in advance.

    yes, even though you may be using a font from the library,
    you still have to specify that each text field that uses that font
    embeds the font, and you'll need to select all characters(well not
    all, unless you require all the different scripts of the world -
    upper-case, lower-case, numerals and punctuation usual suffices).
    I bet if you checked, the computers where the font did not
    appear did not have the font on their system.
    Good luck
    Craig

  • Problem in Using a Text file

    Hello,
    I want to read my text from a text file and it�s not a predetermined text, what i want to do is read the records in the form of text and i want to use "," as the delimiter between each Column in my Output file.
    I was trying to do this but somehow am not Achieving anything meaningful till now.
    Waiting for positive Reply�s from the Forum Memebers.

    The solution has already been suggested on this thread.
    http://forum.java.sun.com/thread.jspa?threadID=686118
    If you didn't get it, here are the steps again:
    1. Read the file using java io http://java.sun.com/docs/books/tutorial/essential/io/
    2. As you read each line, use StringTokenizer or String.split() to separate each value.
    You do not need to have a predetermined text. The only predetermined thing is your delimiter.
    x

  • Problem with CS3 InCopy text files and InDesign CS5

    I have a large annual magazine that I am developing. There is one section that doesn't change much from year to year and I was hoping to grandfather in the InCopy text files from last year's edition. I've successfully used this strategy the past few years without issue. However, now when I try to check out those text files from last year, I receive the following message "This story needs to be coverted to "InCopy Document" format in order to edit it."
    I am running both InDesign CS5 and InCopy CS5 in SL 10.6.4. The previous year's magazine document was in CS3 InDesign format and the text files were in InCopy CS3. Is there some sort of compatibility issue? Is there a specific method for converting them so I can check them out in InDesign? I haven't attempted to check them out in InCopy CS5 yet but I will try that next. But I really need the ability to check out the content via InDesign too.
    Thanks in advance.
    Robert

    AFAIK, you're going to actually need to open the INCX files in InCopy and then resave them as ICML file. You can then relink them all in InDesign.
    Other choice is killing the InCopy links and then relinking everything.
    Best practice would be to finish any job started in CS3 with CS3 and then move to CS5 with new projects.
    Bob

  • Problem while reading from text file using JDeveloper 10.1.2

    Hi,
    I am using JDeveloper 10.1.2 for my application. In this, I have one requirement to read some data from a text file. For that, I created a test file and saved along with the java file folder. From there, I am trying to read this file but it says the file not found exception.
    Application is looking the file from another location. "F:\DevSuiteHome_1\jdev\system10.1.2.1.0.1913\oc4j-config"
    But, I want to read it from my home folder. How is it possible to read from that location?
    Regards,
    Joby Joseph

    HI,
    Check followings will useful
    How to read .txt file from adfLib jar at model layer using relative path
    Accessing physical/relative path from Bean

  • Double quotes problem while uploading tablimeited text file to internal tab

    H all,
    I am uploading excel data using GUI_UPLOAD function module by converting excel to tab delimited text format.
    Problem is Material AB" is converted to "AB"  "           " material in tabdelimited text format.
    Can anybody give solution to problem?
    Is it possible to upload excel file directly using GUI_UPLOAD function module?
    I can not use 'ALSM_EXCEL_TO_INTERNAL_TABLE'  and  'TEXT_CONVERT_XLS_TO_SAP'
    as i want to upload upload fields of length 3000 cahrs and these function module uploads fields of only 256 chars.
    Thanks.

    Get a excel - 97-2003.Fil the data which you want to upload .(3 columns )
    A      I      B     I     C     I.
    save it
    Code :
    TABLES : thead.
    Structure to store the file name, as selected from the open dialog
    TYPES: BEGIN OF file ,
            filename TYPE file_table-filename,
           END OF  file.
    Output for excel
    TYPES : BEGIN OF test,
                   a(5),
                   b(5),
                   c(5),
            END OF test.
    Internal table of excel
    DATA : it_test TYPE TABLE OF test.
    DATA : it_filename TYPE TABLE OF  file,.  "to store file names.
                 ws_filename TYPE       file.
    SELECTION-SCREEN
    PARAMETER: p_file LIKE rlgrap-filename  LOWER CASE.
    At Selection Screen
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    Parameter to store the sy-subrc value from FM file_open_dialog
      DATA: rc TYPE i.
      CLEAR: it_filename,
             ws_filename,
             p_file .
    Get the file name and path from the presenatation server
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title            = 'Select Input File'
          default_filename        = '*.xls'
        CHANGING
          file_table              = it_filename
          rc                      = rc
        EXCEPTIONS
          file_open_dialog_failed = 1
          cntl_error              = 2
          error_no_gui            = 3
          not_supported_by_gui    = 4
          OTHERS                  = 5.
      IF sy-subrc = 0.
        LOOP AT it_filename INTO ws_filename.
          p_file = ws_filename.
          EXIT.
        ENDLOOP.
      ENDIF.
    DATA: l_file TYPE string.
      CLEAR it_test .
      l_file = p_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = l_file
          filetype                = 'ASC'
          has_field_separator     = 'X'
        TABLES
          data_tab                = it_test
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
      IF sy-subrc NE 0.
        WRITE: "Upload error".
        STOP.
      ENDIF.

  • Problem displaying characters from pdf file in Preview.app

    Hi,
    I hope someone can help with this problem.
    I have some issues with the display of pdf files on OSX. The problems are with ligatures like 'fl' which Preview.app displays incorrectly as 'oeu'. There are other symbols which Preview also displays incorrectly.
    This problem is not affected by cleaning the font cache and as far as I can tell all the fonts are present and correct. I am guessing the problem has something to do with Preview finding a different version of the Times or TimesRoman font than Adobe Reader uses, and so it gets the wrong symbol, but I'm not sure.
    How can I ensure that Preview uses the same fonts as Adobe Reader? and how can I get Preview to render my pdf's correctly?
    Here is a sample of the problem with Preview.app (4.1):
    !http://farm4.static.flickr.com/3456/33599073294296beb1a8m.jpg!
    and with Adobe Reader (9.0.0)- correctly rendered:
    !http://farm4.static.flickr.com/3448/335990717548aa12e576m.jpg!

    My computer automatically open PDF inside the Safari
    window, but I wish it would go back to opening it
    externally via Adobe. (maybe we should trade
    computers:-)
    Anyway, we have the same question.
    How do we control whether PDF launches internal to
    Safari, or external in Adobe?
    This is what I would like to as well. I often have a lot of pdf files I need to open and then save to my hard drive. When I click on a pdf file on a website Safari opens it and then I need to right click in the document to open it with Adobe. How can I get it to open in Adobe the first time without having to right click after it opens in Safari?
    Thanks!

  • JEditorPane problem displaying non-English text in 1.4

    hai
    I am trying to display a non English text in JEdiorPane . This is working fine with 13 but not with 1.4. (In 1.4 the non-English text is being rendered in english font).
    I am giving the HTML file and the java code that displays the html file below
    somebody pl help
    HTML file:
    <HTML>
    <HEAD>
    <STYLE>
    font.English0 {font-family:Courier,TimesNewRoman,helvetica,VERDANA,sansserif; font-style:normal;font-size:14pt;}
    font.telugu1 { font-family: Tl_tthemalatha;font-style: normal;font-size: 12pt; }
    font.English1 { font-family: Courier;font-style: normal;font-size: 22pt; }
    </STYLE>
    </HEAD>
    <BODY>
    <font class=telugu1> the non english text </font>
    </BODY>
    </HTML>
    the java code is.............
    class outpane extends JFrame
         JEditorPane jep;
         Syllable sl;
         public static void main(String[] args)
              new outpane(args[0]);
         outpane(String str)
              jep = new JEditorPane();
              jep.setEditable(false);
              jep.setContentType("text/html");
              JScrollPane js = new JScrollPane(jep);
              this.getContentPane().add(js);
              setSize(400,500);
              setVisible(true);
              setText(str);
         void setText(String str)
                   try{
                   BufferedReader br1;
                   FileInputStream fr1;
                   fr1=new FileInputStream(str);
                   br1=new BufferedReader(new InputStreamReader(fr1,"ISO8859-1"));
                        String s = new String();
                        String s1 = new String();
                        int j = 0;
                        while((s = br1.readLine()) != null)
                        s += "\n";
                        // Some mappings...
                        jep.setText(s1);
                        fr1.close();
                   }catch(Exception e){System.out.println("Exp");}
    To menction again this works fine in 1.3. In 1.4 the font is not beibg recognised
    Thanks in Anticipation

    I forgot to mention this happens only in Linux

  • Screen data entry box that displays data from text file AND write back to file.

    I want the user to be able to view/edit a 'setup file' FROM THE SAME INDICATOR BOXES for a application. I tried to read the file(text), display individual data in indicator boxes and re-write file when user is finished. This causes errors since you can't use indicators boxes as inputs for the file write. Is there some kind of indicator/control/data entry box that the user can view the data, edit the data, and re-write the data from the box???

    hi
    I have created this example for your reference.
    I modified the Configuration File Examples in LV Examples, together with a few file check & create functions.
    Hope this will help.
    Note: The Configuration File Example from LV are COOL, indeed.
    Cheers
    ian.f
    Ian F
    Since LabVIEW 5.1... 7.1.1... 2009, 2010
    依恩与LabVIEW
    LVVILIB.blogspot.com
    Attachments:
    iFunc_Setup_Config_File.zip ‏102 KB

  • Problem displaying CLOB

    oracle.xml.sql.OracleXMLSQLException:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06512: at "SYS.DBMS_LOB", line 648 ORA-06512: at line 1
    Trying to display an email message stored in a clob.
    What the issue here and what the workaround?
    TIA
    Rob

    Sorry, it was a bit late :-)
    OK using XSQL 1.0.4.3 and XSU that comes with it, database Oracle 8.1.7.1
    CLOB is just under 70k
    Using XSQL to read the CLOB with a simple
    select CLOB_FIELD from MYTABLE then just display the xml as is.
    Data seems OK, I can uses dbms_lob.substring() to display any part of the field in a sql tool and its OK.
    Rob

  • Problems on Saving a text file

    the "Java Programming" forum is more active compare to "CLDC-MIDP" and "WTK" forum that's why I posted my problem here just case in MIDP programmer dropped by.
    My problem is my phone (Nokia 6260) contains MIDP2.0, the problem is, it has no JSR-75/File Connection API... my application is runs perfectly on my WTK2.2 because it has a JSR-75 jar file...
    but it wont run on my Nokia 6260 phone because of FileConnection API is missing... my question is, is it possible to install the JSR75 on my mobile Nokia6260 phone?
    again, my apology for posting my grievance here...
    thank you so much...

    You can do it by upgrading your firmware .
    If there is upgraded firmware supporting JSR75 then it might solve your problem.

Maybe you are looking for

  • Business Connector 4.7 connection issue with GB HMRC

    Inland Revenue have changed their URL's and SAP issued a new note 1614588 for this change.  As instructed in the note I installed the new package and now when we try to poll with Inland revenue we get a connection refused. I am not too familiar with

  • How to open game center with a maestro card

    Hello, How can I start in I -tunes and game center with à maestro card and not with à credit card? Thanks, Gazer.

  • Unicode error when installing infocube 'co-om-opa'  from BI content

    system says 'include RSTMPL88, in unicode programs, the '&' character cannot appear in names, as it does here in the name "&RN&". it's strange because it never happened to other BW system we installed before. I've tried 'RSKC', but no use. seems the

  • Option to disable UltraNav (touchpad + trackpoint) when external mouse is connected

    I grabbed the 5/2011 drivers for UltraNav from the Lenovo site and it appears that an option 'to disable the integrated pointing devices when an external pointing device is present' does not exist, or at the very least I can't easily find it.  Please

  • BSP programmer error

    Hi Guyz, I have developed one application for Leave on Portal. When I create Absence,It seems to be working but some cases it is not working .I will explain with details. <b>1</b>. To create absence,<b>BAPI_ABSENCE_CREATE</b> is being used .I locked