Github user arvindkandhare commented on a diff in the pull request:

    
https://github.com/apache/incubator-distributedlog/pull/21#discussion_r88817799
  
    --- Diff: 
distributedlog-core/src/main/java/com/twitter/distributedlog/EnvelopedEntry.java
 ---
    @@ -254,21 +253,22 @@ private void read(DataInputStream in) throws 
IOException {
             Payload() {
             }
     
    -        Payload(int length, byte[] payload) {
    +        Payload(int length, ByteBuffer payload) {
                 this.length = length;
                 this.payload = payload;
                 this.ready = true;
             }
     
             private void write(DataOutputStream out) throws IOException {
                 out.writeInt(length);
    -            out.write(payload, 0, length);
    +            out.write(payload.array(), 0, length);
             }
     
             private void read(DataInputStream in) throws IOException {
                 this.length = in.readInt();
    -            this.payload = new byte[length];
    -            in.readFully(payload);
    +            this.payload = ByteBuffer.wrap(new byte[length]);
    +            //TODO: Fix this
    --- End diff --
    
    @leighst The existing Stream based implementation in buffer.java involved 
an avoidable byte array copy. This change request is to fix this. We realized 
that this can be done in a better way. I/@jiazhai will update the pull request 
with the latest changes.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to