diff --git a/IO/src/main/java/io/deephaven/io/streams/ByteBufferInputStream.java b/IO/src/main/java/io/deephaven/io/streams/ByteBufferInputStream.java index 7522906028b..9fea14cd40d 100644 --- a/IO/src/main/java/io/deephaven/io/streams/ByteBufferInputStream.java +++ b/IO/src/main/java/io/deephaven/io/streams/ByteBufferInputStream.java @@ -10,37 +10,27 @@ import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; -import io.deephaven.base.string.cache.CharSequenceAdapterBuilder; -import io.deephaven.base.string.cache.StringCache; import org.jetbrains.annotations.NotNull; /** * This is an InputStream implementation which reads from a java.nio.ByteBuffer. If a read operation crosses the end of * the buffer, the BufferUnderflowException is converted to an EOFException. - * - * The stream contains no state other than that in in the buffer itself, so the buffer can be exchanged at will with the + *
+ * The stream contains no state other than that in the buffer itself, so the buffer can be exchanged at will with the * setBuffer() method. + *
+ * Endianness is determined by the provided buffer itself.
*/
public class ByteBufferInputStream extends java.io.InputStream implements DataInput {
/** the buffer from which we read */
protected ByteBuffer buf;
- private char[] utfChars;
-
- /**
- * The DataOutput interface always writes bytes in big-endian order, while ByteBuffer allows the order to be big- or
- * little-endian. Set this flag true to assume that the buffer is bid-endian, or false to check the buffer's order
- * at each write.
- */
- // protected static final boolean ASSUME_BIG_ENDIAN = true;
-
/**
* Construct a new stream which reads from a byte buffer/
*/
public ByteBufferInputStream(ByteBuffer buf) {
this.buf = buf;
- this.utfChars = new char[0];
}
/**
@@ -64,7 +54,7 @@ public int read() throws IOException {
}
@Override
- public int read(byte b[]) throws IOException {
+ public int read(byte[] b) throws IOException {
int n = Math.min(buf.remaining(), b.length);
if (n == 0 && b.length > 0) {
return -1;
@@ -74,7 +64,7 @@ public int read(byte b[]) throws IOException {
}
@Override
- public int read(byte b[], int off, int len) throws IOException {
+ public int read(byte[] b, int off, int len) throws IOException {
int n = Math.min(buf.remaining(), len);
if (n == 0 && len > 0) {
return -1;
@@ -123,7 +113,7 @@ public boolean markSupported() {
// -----------------------------------------------------------------------------------
@Override
- public void readFully(byte b[]) throws IOException {
+ public void readFully(byte[] b) throws IOException {
try {
buf.get(b, 0, b.length);
} catch (BufferUnderflowException x) {
@@ -132,7 +122,7 @@ public void readFully(byte b[]) throws IOException {
}
@Override
- public void readFully(byte b[], int off, int len) throws IOException {
+ public void readFully(byte[] b, int off, int len) throws IOException {
try {
buf.get(b, off, len);
} catch (BufferUnderflowException x) {
@@ -307,6 +297,7 @@ public String readLine() throws IOException {
return new String(chars);
}
+ @NotNull
@Override
public String readUTF() throws IOException {
int length = 0;
@@ -341,48 +332,4 @@ public String readUTF() throws IOException {
return new String(chars, 0, length);
}
-
- public String readUTF(@NotNull final CharSequenceAdapterBuilder output,
- @NotNull final StringCache