commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Mazursky (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-994) Add zero copy read method to StrBuilder
Date Sat, 12 Apr 2014 02:38:15 GMT

    [ https://issues.apache.org/jira/browse/LANG-994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13967355#comment-13967355
] 

Mikhail Mazursky commented on LANG-994:
---------------------------------------

[~britter], I tried to do that - wrap internal char[] into CharBuffer and call Readable.read(CharBuffer).
Actually such approach do not avoid data copying. Take a look at the Reader.read(CharBuffer)
- it is implemented as follows using intermediate char[]:

{code}
    public int read(java.nio.CharBuffer target) throws IOException {
        int len = target.remaining();
        char[] cbuf = new char[len];
        int n = read(cbuf, 0, len);
        if (n > 0)
            target.put(cbuf, 0, n);
        return n;
    }
{code}

> Add zero copy read method to StrBuilder
> ---------------------------------------
>
>                 Key: LANG-994
>                 URL: https://issues.apache.org/jira/browse/LANG-994
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.text.*
>    Affects Versions: 3.3.1
>            Reporter: Mikhail Mazursky
>             Fix For: Review Patch, Discussion, 3.4
>
>         Attachments: LANG-994.patch
>
>
> I propose to add a method that will read (from Reader) directly into the internal character
array of the StrReader.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message