org.zodiac.sdk.simplenetty.channel.AbstractNioSocketChannel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zodiac-sdk-nio Show documentation
Show all versions of zodiac-sdk-nio Show documentation
Zodiac SDK NIO2(New Non-Blocking IO)
package org.zodiac.sdk.simplenetty.channel;
import java.nio.ByteBuffer;
import org.zodiac.sdk.simplenetty.core.EventLoop;
public abstract class AbstractNioSocketChannel extends AbstractNioChannel {
ByteBuffer readBuffer;
ByteBuffer writeBuffer;
public AbstractNioSocketChannel(EventLoop loop) {
super(loop);
init();
}
private void init() {
Integer bufferSize = ChannelConfig.getChildOption(ChannelOption.BUFFER_SIZE.name, Integer.class);
if (bufferSize == null) {
bufferSize = ChannelOption.BUFFER_SIZE.value;
}
readBuffer = ByteBuffer.allocate(bufferSize);
writeBuffer = ByteBuffer.allocate(bufferSize);
}
}