我想问下 为什么我在ioBuffer.putString(s, charsetEncoder);的时候 报错了
The method putString(CharSequence, CharsetEncoder) from the type IoBuffer refers to the missing type CharSequence 这是报错的原因
String s = null;
if(message instanceof String){
s = (String)message;
}
if(s != null){
CharsetEncoder charsetEncoder = (CharsetEncoder)session.getAttribute("encoder");
if(charsetEncoder == null){
charsetEncoder = Charset.defaultCharset().newEncoder();
}
IoBuffer ioBuffer = IoBuffer.allocate(s.length());
ioBuffer.setAutoExpand(true);
ioBuffer.putString(s, charsetEncoder);
ioBuffer.flip();
out.write(ioBuffer);
}
这是我的代码