You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Albert Lee (JIRA)" <ji...@apache.org> on 2012/07/27 17:20:34 UTC

[jira] [Updated] (OPENJPA-2231) jest TokenReplacedStream use Reader instead of Inputstream

     [ https://issues.apache.org/jira/browse/OPENJPA-2231?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Albert Lee updated OPENJPA-2231:
--------------------------------

    Attachment: OPENJPA-2231.patch

Can not remove the replace(InputStream....) method to aovid breaking application that currently using this method.

Add a new replace(Reader...) method instead.

Please check if this meets your need. I'll commit this change in trunk after your confirmation.
                
> jest  TokenReplacedStream use Reader instead of Inputstream
> -----------------------------------------------------------
>
>                 Key: OPENJPA-2231
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2231
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: jpa
>    Affects Versions: 2.2.0
>            Reporter: Herman Vierendeels
>            Priority: Trivial
>              Labels: jest
>             Fix For: 2.2.0
>
>         Attachments: OPENJPA-2231.patch
>
>
> in order to preserve utf-8 characters in replace-function , use Reader instead of Inputstream
> public class TokenReplacedStream {
> ...
> //public void replace(InputStream in, Writer out, String... prs) throws IOException {
>  public void replace(Reader in, Writer out, String... prs) throws IOException {
> using new type:
> InputStream in=servletContext.getResourceAsStream(rsrc);
> BufferedReader in_br=new BufferedReader(new InputStreamReader(in,"UTF-8"));
> new TokenReplacedStream().replace(in_br,out_char,tokens);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira