func (b *netpollByteBuffer) Write(p []byte) (n int, err error) {
	if b.status&remote.BitWritable == 0 {
		return -1, errors.New("unwritable buffer, cannot support Write")
	}
	if b.ioWriter != nil {
		return b.ioWriter.Write(p)
	}
	return -1, errors.New("ioWriter is nil")
}
Write implement io.Writer
package netpoll
import (
	"errors"
	"io"
	"sync"
	"github.com/cloudwego/netpoll"
	"github.com/cloudwego/kitex/pkg/remote"
)
var bytebufPool sync.Pool
func init() {
	bytebufPool.New = newNetpollByteBuffer
}
func NewReaderByteBuffer(r netpoll.Reader) remote.ByteBuffer {
	bytebuf := bytebufPool.Get().(*netpollByteBuffer)
	bytebuf.reader = r
	if ir, ok := r.(io.Reader); ok {
		bytebuf.ioReader = ir
	}
	bytebuf.status = remote.BitReadable
	bytebuf.readSize = 0
	return bytebuf
}
func NewWriterByteBuffer(w netpoll.Writer) remote.ByteBuffer {
	bytebuf := bytebufPool.Get().(*netpollByteBuffer)
	bytebuf.writer = w
	if iw, ok := w.(io.Writer); ok {
		bytebuf.ioWriter = iw
	}
	bytebuf.status = remote.BitWritable
	return bytebuf
}
func NewReaderWriterByteBuffer(rw netpoll.ReadWriter) remote.ByteBuffer {
	bytebuf := bytebufPool.Get().(*netpollByteBuffer)
	bytebuf.writer = rw
	bytebuf.reader = rw
	if irw, ok := rw.(io.ReadWriter); ok {
		bytebuf.ioReader = irw
		bytebuf.ioWriter = irw
	}
	bytebuf.status = remote.BitWritable | remote.BitReadable
	return bytebuf
}
func newNetpollByteBuffer() interface{} {
	return &netpollByteBuffer{}
}
type netpollByteBuffer struct {
	writer   netpoll.Writer
	reader   netpoll.Reader
	ioReader io.Reader
	ioWriter io.Writer
	status   int
	readSize int
}
var _ remote.ByteBuffer = &netpollByteBuffer{}
func (b *netpollByteBuffer) Next(n int) (p []byte, err error) {
	if b.status&remote.BitReadable == 0 {
		return nil, errors.New("unreadable buffer, cannot support Next")
	}
	if p, err = b.reader.Next(n); err == nil {
		b.readSize += n
	}
	return
}
func (b *netpollByteBuffer) Peek(n int) (buf []byte, err error) {
	if b.status&remote.BitReadable == 0 {
		return nil, errors.New("unreadable buffer, cannot support Peek")
	}
	return b.reader.Peek(n)
}
func (b *netpollByteBuffer) Skip(n int) (err error) {
	if b.status&remote.BitReadable == 0 {
		return errors.New("unreadable buffer, cannot support Skip")
	}
	return b.reader.Skip(n)
}
func (b *netpollByteBuffer) ReadableLen() (n int) {
	if b.status&remote.BitReadable == 0 {
		return -1
	}
	return b.reader.Len()
}
func (b *netpollByteBuffer) Read(p []byte) (n int, err error) {
	if b.status&remote.BitReadable == 0 {
		return -1, errors.New("unreadable buffer, cannot support Read")
	}
	if b.ioReader != nil {
		return b.ioReader.Read(p)
	}
	return -1, errors.New("ioReader is nil")
}
func (b *netpollByteBuffer) ReadString(n int) (s string, err error) {
	if b.status&remote.BitReadable == 0 {
		return "", errors.New("unreadable buffer, cannot support ReadString")
	}
	if s, err = b.reader.ReadString(n); err == nil {
		b.readSize += n
	}
	return
}
func (b *netpollByteBuffer) ReadBinary(n int) (p []byte, err error) {
	if b.status&remote.BitReadable == 0 {
		return p, errors.New("unreadable buffer, cannot support ReadBinary")
	}
	if p, err = b.reader.ReadBinary(n); err == nil {
		b.readSize += n
	}
	return
}
func (b *netpollByteBuffer) Malloc(n int) (buf []byte, err error) {
	if b.status&remote.BitWritable == 0 {
		return nil, errors.New("unwritable buffer, cannot support Malloc")
	}
	return b.writer.Malloc(n)
}
func (b *netpollByteBuffer) MallocLen() (length int) {
	if b.status&remote.BitWritable == 0 {
		return -1
	}
	return b.writer.MallocLen()
}