Camel
  1. Camel
  2. CAMEL-4813

Add a converter to turn StringBuffer to InputStream

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.7.5, 2.8.4, 2.9.1
    • Component/s: camel-core
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      As the user request[1], we need to consider to provide a converter for StringBuffer
      [1]http://camel.465427.n5.nabble.com/TypeConverter-for-StringBuilder-tp5092438p5092438.html

        Activity

        Willem Jiang created issue -
        Willem Ning Jiang <ningjiang@apache.org> committed 1c4c0f139a2f92b728808c44fa8903221bc15369 (2 files)
        ningjiang committed 1222006 (2 files)
        Willem Ning Jiang <ningjiang@apache.org> committed fac22077b18fe0b44b11e3d76b4e828bb75bfead (2 files)
        Reviews: none

        Merged revisions 1222006 via svnmerge from https://svn.apache.org/repos/asf/camel/trunk
        ........
          r1222006 | ningjiang | 2011-12-22 10:37:19 +0800 (Thu, 22 Dec 2011) | 1 line
          
          CAMEL-4813 Added a converter to turn StringBuffer to InputStream
        ........


        git-svn-id: https://svn.apache.org/repos/asf/camel/branches/camel-2.8.x@1222020 13f79535-47bb-0310-9956-ffa450edef68

        ningjiang committed 1222020 (3 files)
        Reviews: none

        Merged revisions 1222006 via svnmerge from
        https://svn.apache.org/repos/asf/camel/trunk

        ........
          r1222006 | ningjiang | 2011-12-22 10:37:19 +0800 (Thu, 22 Dec 2011) | 1 line
          
          CAMEL-4813 Added a converter to turn StringBuffer to InputStream
        ........

        Hide
        Claus Ibsen added a comment -

        Willem can you add for StringBuilder as well (there is both a StringBuffer and StringBuilder in the JDK)

        Show
        Claus Ibsen added a comment - Willem can you add for StringBuilder as well (there is both a StringBuffer and StringBuilder in the JDK)
        Willem Ning Jiang <ningjiang@apache.org> committed 5f832a7a24544888b8f0bf0b5ea922c6f12e2399 (2 files)
        ningjiang committed 1222066 (2 files)
        Willem Ning Jiang <ningjiang@apache.org> committed 72211dab9266d80252c22418b5757520d1bca858 (2 files)
        Reviews: none

        Merged revisions 1222020 via svnmerge from https://svn.apache.org/repos/asf/camel/branches/camel-2.8.x
        ................
          r1222020 | ningjiang | 2011-12-22 11:33:48 +0800 (Thu, 22 Dec 2011) | 9 lines
          
          Merged revisions 1222006 via svnmerge from
          https://svn.apache.org/repos/asf/camel/trunk
          
          ........
            r1222006 | ningjiang | 2011-12-22 10:37:19 +0800 (Thu, 22 Dec 2011) | 1 line
            
            CAMEL-4813 Added a converter to turn StringBuffer to InputStream
          ........
        ................


        git-svn-id: https://svn.apache.org/repos/asf/camel/branches/camel-2.7.x@1222069 13f79535-47bb-0310-9956-ffa450edef68

        ningjiang committed 1222069 (3 files)
        Reviews: none

        Merged revisions 1222020 via svnmerge from
        https://svn.apache.org/repos/asf/camel/branches/camel-2.8.x

        ................
          r1222020 | ningjiang | 2011-12-22 11:33:48 +0800 (Thu, 22 Dec 2011) | 9 lines
          
          Merged revisions 1222006 via svnmerge from
          https://svn.apache.org/repos/asf/camel/trunk
          
          ........
            r1222006 | ningjiang | 2011-12-22 10:37:19 +0800 (Thu, 22 Dec 2011) | 1 line
            
            CAMEL-4813 Added a converter to turn StringBuffer to InputStream
          ........
        ................

        Willem Ning Jiang <ningjiang@apache.org> committed 76e86d66f97d2e76e40cc529c60be96c5a2ec838 (2 files)
        Reviews: none

        Merged revisions 1222066 via svnmerge from https://svn.apache.org/repos/asf/camel/trunk
        ........
          r1222066 | ningjiang | 2011-12-22 14:42:21 +0800 (Thu, 22 Dec 2011) | 1 line
          
           CAMEL-4813 Added a converter for StringBuilder as Claus suggested
        ........


        git-svn-id: https://svn.apache.org/repos/asf/camel/branches/camel-2.8.x@1222077 13f79535-47bb-0310-9956-ffa450edef68

        ningjiang committed 1222077 (3 files)
        Reviews: none

        Merged revisions 1222066 via svnmerge from
        https://svn.apache.org/repos/asf/camel/trunk

        ........
          r1222066 | ningjiang | 2011-12-22 14:42:21 +0800 (Thu, 22 Dec 2011) | 1 line
          
           CAMEL-4813 Added a converter for StringBuilder as Claus suggested
        ........

        Hide
        Babak Vahdat added a comment -

        IMHO just changing the signature to:

        @Converter
        public static InputStream toInputStream(AbstractStringBuilder builder, Exchange exchange) throws IOException;
        

        should do the trick, so that we don't have to duplicate the code. However I haven't tried that and don't know if the Converter lookup-logic would support this dynamic type approach as well.

        Show
        Babak Vahdat added a comment - IMHO just changing the signature to: @Converter public static InputStream toInputStream(AbstractStringBuilder builder, Exchange exchange) throws IOException; should do the trick, so that we don't have to duplicate the code. However I haven't tried that and don't know if the Converter lookup-logic would support this dynamic type approach as well.
        Hide
        Babak Vahdat added a comment -

        Oops AbstractStringBuilder seems to be package private

        Show
        Babak Vahdat added a comment - Oops AbstractStringBuilder seems to be package private
        Willem Ning Jiang <ningjiang@apache.org> committed d6c896292353912527484ee890c95d1ad883357b (2 files)
        Reviews: none

        Merged revisions 1222077 via svnmerge from https://svn.apache.org/repos/asf/camel/branches/camel-2.8.x
        ................
          r1222077 | ningjiang | 2011-12-22 15:17:22 +0800 (Thu, 22 Dec 2011) | 9 lines
          
          Merged revisions 1222066 via svnmerge from
          https://svn.apache.org/repos/asf/camel/trunk
          
          ........
            r1222066 | ningjiang | 2011-12-22 14:42:21 +0800 (Thu, 22 Dec 2011) | 1 line
            
             CAMEL-4813 Added a converter for StringBuilder as Claus suggested
          ........
        ................


        git-svn-id: https://svn.apache.org/repos/asf/camel/branches/camel-2.7.x@1222081 13f79535-47bb-0310-9956-ffa450edef68

        ningjiang committed 1222081 (3 files)
        Reviews: none

        Merged revisions 1222077 via svnmerge from
        https://svn.apache.org/repos/asf/camel/branches/camel-2.8.x

        ................
          r1222077 | ningjiang | 2011-12-22 15:17:22 +0800 (Thu, 22 Dec 2011) | 9 lines
          
          Merged revisions 1222066 via svnmerge from
          https://svn.apache.org/repos/asf/camel/trunk
          
          ........
            r1222066 | ningjiang | 2011-12-22 14:42:21 +0800 (Thu, 22 Dec 2011) | 1 line
            
             CAMEL-4813 Added a converter for StringBuilder as Claus suggested
          ........
        ................

        Hide
        Willem Jiang added a comment -

        Applied patch into trunk, camel-2.8.x and camel-2.7.x branches.

        Show
        Willem Jiang added a comment - Applied patch into trunk, camel-2.8.x and camel-2.7.x branches.
        Willem Jiang made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Willem Jiang
            Reporter:
            Willem Jiang
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development