Yingyi Bu has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/500

Change subject: Override the reset method in ByteArrayAccessibleOutputStream.
......................................................................

Override the reset method in ByteArrayAccessibleOutputStream.

Change-Id: Ib43f0b0fd9291b4a7e08963abb850d368ae2c288
---
M 
hyracks/hyracks-data/hyracks-data-std/src/main/java/org/apache/hyracks/data/std/util/ByteArrayAccessibleOutputStream.java
1 file changed, 10 insertions(+), 3 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/hyracks refs/changes/00/500/1

diff --git 
a/hyracks/hyracks-data/hyracks-data-std/src/main/java/org/apache/hyracks/data/std/util/ByteArrayAccessibleOutputStream.java
 
b/hyracks/hyracks-data/hyracks-data-std/src/main/java/org/apache/hyracks/data/std/util/ByteArrayAccessibleOutputStream.java
index 287e2f2..7242340 100644
--- 
a/hyracks/hyracks-data/hyracks-data-std/src/main/java/org/apache/hyracks/data/std/util/ByteArrayAccessibleOutputStream.java
+++ 
b/hyracks/hyracks-data/hyracks-data-std/src/main/java/org/apache/hyracks/data/std/util/ByteArrayAccessibleOutputStream.java
@@ -35,6 +35,13 @@
         return buf;
     }
 
+    // Override to make it not synchronized.
+    @Override
+    public void reset() {
+        count = 0;
+    }
+
+    @Override
     public void write(int b) {
         ensureCapacity(count + 1);
         buf[count] = (byte) b;
@@ -46,12 +53,11 @@
      * This function is used to drop the already written delta bytes.
      * In some cases, we write some bytes, and afterward we found we've 
written more than expected.
      * Then we need to fix the position by rewind the current position to the 
expected one.
-     *
      * Currently, it is used by the {@link AbstractVarLenObjectBuilder} which 
may take more space than required
      * at beginning, and it will shift the data and fix the position whenever 
required.
-     *
      * It will throw {@link IndexOutOfBoundsException} if the {@code delta} is 
negative.
      * Evil function, use with caution.
+     *
      * @param delta
      */
     public void rewindPositionBy(int delta) {
@@ -81,7 +87,8 @@
      * Increases the capacity to ensure that it can hold at least the
      * number of elements specified by the minimum capacity argument.
      *
-     * @param minCapacity the desired minimum capacity
+     * @param minCapacity
+     *            the desired minimum capacity
      */
     private void grow(int minCapacity) {
         // overflow-conscious code

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/500
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib43f0b0fd9291b4a7e08963abb850d368ae2c288
Gerrit-PatchSet: 1
Gerrit-Project: hyracks
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <[email protected]>

Reply via email to