commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Veithen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (IO-158) ReaderInputStream implementation
Date Wed, 28 May 2008 18:23:45 GMT

    [ https://issues.apache.org/jira/browse/IO-158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12600555#action_12600555
] 

Andreas Veithen commented on IO-158:
------------------------------------

The byte representation of a UTF-16 string starts with a two byte sequence that indicates
the byte order. The concatenation of "abc".getBytes("UTF-16") and "def".getBytes("UTF-16")
will therefore contain this marker twice and yield a result different from "abcdef".getBytes("UTF-16").
This would not be the expected behavior for ReaderInputStream. There is no bug in the JRE,
the fact is simply that for some charsets, calling getBytes on the concatenation of a set
of strings doesn't give the same result as concatenating the byte arrays obtained by calling
getBytes on these same strings. However ReaderInputStream must produce a sequence of bytes
that is equivalent to the first case.

> ReaderInputStream implementation
> --------------------------------
>
>                 Key: IO-158
>                 URL: https://issues.apache.org/jira/browse/IO-158
>             Project: Commons IO
>          Issue Type: Wish
>            Reporter: Andreas Veithen
>            Priority: Minor
>
> The standard Java class InputStreamReader converts a Reader into an InputStream. In some
cases it is necessary to do the reverse, i.e. to convert a Reader into an InputStream. Several
frameworks and libraries have their own implementation of this functionality (google for "ReaderInputStream").
Among these are at least four Apache projects: Ant, iBatis, James and XMLBeans. Commons IO
would be a good place to share a common implementation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message