MINOR: Cleanup dead IO code

Fixes #7953
This commit is contained in:
Armin 2017-08-09 11:49:32 +02:00 committed by Armin Braun
parent 492cae9808
commit b30500ab0c
5 changed files with 0 additions and 99 deletions

View file

@ -19,17 +19,6 @@ public final class BufferedChecksumStreamInput extends StreamInput {
this.digest = new BufferedChecksum(new CRC32());
}
public BufferedChecksumStreamInput(StreamInput in, BufferedChecksumStreamInput reuse) {
this.in = in;
if (reuse == null ) {
this.digest = new BufferedChecksum(new CRC32());
} else {
this.digest = reuse.digest;
digest.reset();
this.skipBuffer = reuse.skipBuffer;
}
}
public long getChecksum() {
return this.digest.getValue();
}

View file

@ -1,7 +1,5 @@
package org.logstash.common.io;
import java.nio.ByteBuffer;
public class ByteArrayStreamOutput extends StreamOutput {
private byte[] bytes;
@ -12,18 +10,6 @@ public class ByteArrayStreamOutput extends StreamOutput {
reset(bytes);
}
public ByteArrayStreamOutput(ByteBuffer bytebuffer) {
reset(bytebuffer.array());
}
public ByteArrayStreamOutput(ByteBuffer bytebuffer, int offset, int len) {
reset(bytebuffer.array(), offset, len);
}
public ByteArrayStreamOutput(byte[] bytes, int offset, int len) {
reset(bytes, offset, len);
}
public void reset(byte[] bytes) {
reset(bytes, 0, bytes.length);
}

View file

@ -67,10 +67,6 @@ public class ByteBufferStreamInput extends StreamInput {
buffer.position(position);
}
public void rewind() {
buffer.rewind();
}
@Override
public int available() throws IOException {
return buffer.remaining();

View file

@ -31,41 +31,6 @@ public abstract class StreamInput extends InputStream {
return ((readByte() & 0xFF) << 24) | ((readByte() & 0xFF) << 16)
| ((readByte() & 0xFF) << 8) | (readByte() & 0xFF);
}
/**
* Reads an int stored in variable-length format. Reads between one and
* five bytes. Smaller values take fewer bytes. Negative numbers
* will always use all 5 bytes and are therefore better serialized
* using {@link #readInt}
*
* @return integer value from var-int formatted bytes
* @throws IOException if an error occurs while reading content
*/
public int readVInt() throws IOException {
byte b = readByte();
int i = b & 0x7F;
if ((b & 0x80) == 0) {
return i;
}
b = readByte();
i |= (b & 0x7F) << 7;
if ((b & 0x80) == 0) {
return i;
}
b = readByte();
i |= (b & 0x7F) << 14;
if ((b & 0x80) == 0) {
return i;
}
b = readByte();
i |= (b & 0x7F) << 21;
if ((b & 0x80) == 0) {
return i;
}
b = readByte();
assert (b & 0x80) == 0;
return i | ((b & 0x7F) << 28);
}
/**
* Reads two bytes and returns a short.

View file

@ -15,34 +15,6 @@ public abstract class StreamOutput extends OutputStream {
public abstract void reset() throws IOException;
/**
* Writes an int in a variable-length format. Writes between one and
* five bytes. Smaller values take fewer bytes. Negative numbers
* will always use all 5 bytes and are therefore better serialized
* using {@link #writeInt}
*
* @param i The integer to write
* @throws IOException if an error occurs while writing content
*/
public void writeVInt(int i) throws IOException {
while ((i & ~0x7F) != 0) {
writeByte((byte) ((i & 0x7f) | 0x80));
i >>>= 7;
}
writeByte((byte) i);
}
/**
* Writes a short as two bytes.
*
* @param i The short to write
* @throws IOException if an error occurs while writing content
*/
public void writeShort(short i) throws IOException {
writeByte((byte)(i >> 8));
writeByte((byte) i);
}
/**
* Writes an int as four bytes.
*
@ -56,13 +28,6 @@ public abstract class StreamOutput extends OutputStream {
writeByte((byte) i);
}
public void writeIntArray(int[] values) throws IOException {
writeVInt(values.length);
for (int value : values) {
writeInt(value);
}
}
/**
* Writes a long as eight bytes.
*