accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject [2/3] accumulo git commit: Merge branch '1.6' into 1.7
Date Wed, 20 Jan 2016 19:43:20 GMT
Merge branch '1.6' into 1.7

Conflicts:
	core/src/main/java/org/apache/accumulo/core/data/ArrayByteSequence.java


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/1b905ce1
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/1b905ce1
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/1b905ce1

Branch: refs/heads/1.7
Commit: 1b905ce112565b9450fe66c762ea1cfa30212295
Parents: c9c60d3 27300d8
Author: Keith Turner <kturner@apache.org>
Authored: Wed Jan 20 12:51:51 2016 -0500
Committer: Keith Turner <kturner@apache.org>
Committed: Wed Jan 20 12:51:51 2016 -0500

----------------------------------------------------------------------
 .../accumulo/core/data/ArrayByteSequence.java   | 11 ++-
 .../accumulo/core/util/ByteBufferUtil.java      | 34 +++++--
 .../core/util/UnsynchronizedBuffer.java         |  4 +-
 .../accumulo/core/util/ByteBufferUtilTest.java  | 98 ++++++++++++++++++++
 4 files changed, 131 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/1b905ce1/core/src/main/java/org/apache/accumulo/core/data/ArrayByteSequence.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/data/ArrayByteSequence.java
index f894dbf,d040139..5d16541
--- a/core/src/main/java/org/apache/accumulo/core/data/ArrayByteSequence.java
+++ b/core/src/main/java/org/apache/accumulo/core/data/ArrayByteSequence.java
@@@ -21,9 -21,8 +21,11 @@@ import static java.nio.charset.Standard
  import java.io.Serializable;
  import java.nio.ByteBuffer;
  
+ import org.apache.accumulo.core.util.ByteBufferUtil;
+ 
 +/**
 + * An implementation of {@link ByteSequence} that uses a backing byte array.
 + */
  public class ArrayByteSequence extends ByteSequence implements Serializable {
  
    private static final long serialVersionUID = 1L;
@@@ -79,24 -53,15 +81,23 @@@
      this(s.getBytes(UTF_8));
    }
  
 +  /**
 +   * Creates a new sequence based on a byte buffer. If the byte buffer has an array, that
array (and the buffer's offset and limit) are used; otherwise, a new
 +   * backing array is created and a relative bulk get is performed to transfer the buffer's
contents (starting at its current position and not beyond its
 +   * limit).
 +   *
 +   * @param buffer
 +   *          byte buffer
 +   */
    public ArrayByteSequence(ByteBuffer buffer) {
-     this.length = buffer.remaining();
- 
      if (buffer.hasArray()) {
        this.data = buffer.array();
-       this.offset = buffer.position();
+       this.offset = buffer.position() + buffer.arrayOffset();
+       this.length = buffer.remaining();
      } else {
-       this.data = new byte[length];
        this.offset = 0;
-       buffer.get(data);
+       this.data = ByteBufferUtil.toBytes(buffer);
+       this.length = data.length;
      }
    }
  

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1b905ce1/core/src/main/java/org/apache/accumulo/core/util/ByteBufferUtil.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1b905ce1/core/src/main/java/org/apache/accumulo/core/util/UnsynchronizedBuffer.java
----------------------------------------------------------------------


Mime
View raw message