You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@fluo.apache.org by keith-turner <gi...@git.apache.org> on 2017/05/08 19:06:36 UTC

[GitHub] incubator-fluo issue #827: Add copyTo() method to bytes

Github user keith-turner commented on the issue:

    https://github.com/apache/incubator-fluo/issues/827
  
    For the case where a subsequence of a Bytes object needs to be copied, I was thinking the `subsequence()` method could be used.  For example the following could copy the 1st 255 bytes of `b1` to `dest` starting at offset 1024.
    
    ```java 
    
    byte[] dest = ...
    
    Bytes b1;
    
    b1.subsequence(0,255).copyTo(dest, 1024);
    ```
    
    However, calling subsequence will allocate an intermediate Bytes object.  To avoid this, we could have a method like `copyTo(int sourceOffset,  byte[] dest, int destOffset, int len)` instead of `copyTo(byte[] dest, int offset)`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---