aboutsummaryrefslogtreecommitdiffstats
path: root/vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-01-10 19:15:52 +0100
committerGitHub <noreply@github.com>2017-01-10 19:15:52 +0100
commit697fa08ac031476eee46f7b9cc8b902617ad2371 (patch)
tree1aee34e9b0a15e2000054b859dcc80ca5d352c2a /vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java
parent4a4b1952754ef75b86d35eb1a85bdc180eeb935c (diff)
parentf3b8b754e40c346ca2ea23cf8f114adbbab041a7 (diff)
Merge pull request #1472 from yahoo/revert-1462-bratseth/tensor-dense-binary-format
Revert "Add (disabled) dense tensor binary format"
Diffstat (limited to 'vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java')
-rw-r--r--vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java32
1 files changed, 7 insertions, 25 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java b/vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java
index eba749bd14e..c33882052b4 100644
--- a/vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java
+++ b/vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java
@@ -1,8 +1,6 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.io;
-import com.yahoo.text.Utf8;
-
import java.nio.*;
/**
@@ -22,22 +20,21 @@ import java.nio.*;
* No methods except getByteBuffer() expose the encapsulated
* ByteBuffer, which is intentional.
*
- * @author Einar M R Rosenvinge
+ * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
*/
public class GrowableByteBuffer implements Comparable<GrowableByteBuffer> {
-
public static final int DEFAULT_BASE_SIZE = 64*1024;
public static final float DEFAULT_GROW_FACTOR = 2.0f;
private ByteBuffer buffer;
private float growFactor;
private int mark = -1;
- // NOTE: It might have been better to subclass HeapByteBuffer,
- // but that class is package-private. Subclassing ByteBuffer would involve
- // implementing a lot of abstract methods, which would mean reinventing
- // some (too many) wheels.
+ //NOTE: It might have been better to subclass HeapByteBuffer,
+ //but that class is package-private. Subclassing ByteBuffer would involve
+ //implementing a lot of abstract methods, which would mean reinventing
+ //some (too many) wheels.
- // CONSTRUCTORS:
+ //CONSTRUCTORS:
public GrowableByteBuffer() {
this(DEFAULT_BASE_SIZE, DEFAULT_GROW_FACTOR);
@@ -64,7 +61,7 @@ public class GrowableByteBuffer implements Comparable<GrowableByteBuffer> {
}
- // ACCESSORS:
+ //ACCESSORS:
public float getGrowFactor() {
return growFactor;
@@ -367,21 +364,6 @@ public class GrowableByteBuffer implements Comparable<GrowableByteBuffer> {
}
}
- /** Writes this string to the buffer as a 1_4 encoded length in bytes followed by the utf8 bytes */
- public void putUtf8String(String value) {
- byte[] stringBytes = Utf8.toBytes(value);
- putInt1_4Bytes(stringBytes.length);
- put(stringBytes);
- }
-
- /** Reads a string from the buffer as a 1_4 encoded length in bytes followed by the utf8 bytes */
- public String getUtf8String() {
- int stringLength = getInt1_4Bytes();
- byte[] stringBytes = new byte[stringLength];
- get(stringBytes);
- return Utf8.toString(stringBytes);
- }
-
/**
* Computes the size used for storing the given integer using 1 or 4 bytes.
*