diff --git a/service-td/src/main/java/io/volvox/td/BufferUtils.java b/service-td/src/main/java/io/volvox/td/BufferUtils.java index 654b87e..a85032f 100644 --- a/service-td/src/main/java/io/volvox/td/BufferUtils.java +++ b/service-td/src/main/java/io/volvox/td/BufferUtils.java @@ -8,49 +8,6 @@ import java.io.IOException; public class BufferUtils { - private static final int CHUNK_SIZE = 8192; - - public static void writeBuf(ByteBufOutputStream os, Buffer dataToWrite) throws IOException { - var len = dataToWrite.length(); - os.writeInt(len); - byte[] part = new byte[CHUNK_SIZE]; - for (int i = 0; i < len; i += CHUNK_SIZE) { - var end = Math.min(i + CHUNK_SIZE, len); - dataToWrite.getBytes(i, end, part, 0); - os.write(part, 0, end - i); - } - } - - public static Buffer readBuf(ByteBufInputStream is) throws IOException { - int len = is.readInt(); - Buffer buf = Buffer.buffer(len); - byte[] part = new byte[1024]; - int readPart = 0; - for (int i = 0; i < len; i += 1024) { - var lenx = (Math.min(i + 1024, len)) - i; - if (lenx > 0) { - readPart = is.readNBytes(part, 0, lenx); - buf.appendBytes(part, 0, readPart); - } - } - return buf; - } - - public static io.vertx.core.buffer.Buffer rxReadBuf(ByteBufInputStream is) throws IOException { - int len = is.readInt(); - io.vertx.core.buffer.Buffer buf = io.vertx.core.buffer.Buffer.buffer(len); - byte[] part = new byte[1024]; - int readPart = 0; - for (int i = 0; i < len; i += 1024) { - var lenx = (Math.min(i + 1024, len)) - i; - if (lenx > 0) { - readPart = is.readNBytes(part, 0, lenx); - buf.appendBytes(part, 0, readPart); - } - } - return buf; - } - public interface Writer { void write(ByteBufOutputStream os) throws IOException;