Override the reset method in ByteArrayAccessibleOutputStream.
Change-Id: Ib43f0b0fd9291b4a7e08963abb850d368ae2c288
Reviewed-on: https://asterix-gerrit.ics.uci.edu/500
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
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