Socket Client UI 기본 골격 작성
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
package com.eactive.testmaster.client.service.internal;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.handler.codec.ByteToMessageDecoder;
|
||||
import java.util.List;
|
||||
|
||||
public class FixedLengthFrameDecoder extends ByteToMessageDecoder {
|
||||
private final int frameLength;
|
||||
|
||||
public FixedLengthFrameDecoder(int frameLength) {
|
||||
if (frameLength <= 0) {
|
||||
throw new IllegalArgumentException("frameLength must be a positive integer: " + frameLength);
|
||||
}
|
||||
this.frameLength = frameLength;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
|
||||
while (in.readableBytes() >= frameLength) {
|
||||
ByteBuf buf = in.readBytes(frameLength);
|
||||
out.add(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user