Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-2503

Extend DataInput & DataOutput to avoid copy of byte[]

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Do
    • Icon: Optional Optional
    • 5.1.4
    • 5.0.4
    • None

      "DataInput's void readFully(byte b[])" will cause an extra copy when reading bytes from DataInput. Sometimes business logic needs to read bytes from DataInput first, then process them conditionally(or will not process at all) , is it possible to support ByteBuffer api like:

      public interface XDataInput extends DataInput

      {     ByteBuffer readBuffer(int n); }

      public interface XDataOutput extends DataOutput

      {     void writeBuffer(ByteBuffer value); }

      ByteArrayDataInputStream.java

      @Override
      public ByteBuffer readBuffer(int n)

      {     ByteBuffer r = wrap(this.buf, this.pos, n); this.pos += n; return r; }

      public interface Streamable

      {     void writeTo(XDataOutput out) throws IOException;     void readFrom(XDataInput in) throws IOException, ClassNotFoundException; }

              rhn-engineering-bban Bela Ban
              nafan.xjq Jingqi Xu (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: