本文整理了Java中org.littleshoot.mina.common.ByteBuffer.setAutoExpand()
方法的一些代码示例,展示了ByteBuffer.setAutoExpand()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuffer.setAutoExpand()
方法的具体详情如下:
包路径:org.littleshoot.mina.common.ByteBuffer
类名称:ByteBuffer
方法名:setAutoExpand
[英]Turns on or off autoExpand.
[中]打开或关闭自动展开。
代码示例来源:origin: org.littleshoot/mina-port
public ByteBuffer setAutoExpand(boolean autoExpand) {
buf.setAutoExpand(autoExpand);
return this;
}
代码示例来源:origin: org.littleshoot/sip-stack
private Context()
{
decoder = charset.newDecoder();
buf = ByteBuffer.allocate(80).setAutoExpand(true);
}
代码示例来源:origin: org.littleshoot/mina-port
private Context() {
decoder = charset.newDecoder();
buf = ByteBuffer.allocate(80).setAutoExpand(true);
}
代码示例来源:origin: org.littleshoot/mina-port
public IoSessionInputStream() {
buf = ByteBuffer.allocate(16);
buf.setAutoExpand(true);
buf.limit(0);
}
代码示例来源:origin: org.littleshoot/mina-util
public IoSessionInputStream(final IoSession ioSession,
final int readTimeout)
{
m_ioSession = ioSession;
m_readTimeout = readTimeout;
m_buf = ByteBuffer.allocate(16);
m_buf.setAutoExpand(true);
m_buf.limit(0);
}
代码示例来源:origin: org.littleshoot/sip-stack
public ByteBuffer encode(final SipMessage message)
{
final ByteBuffer buffer = ByteBuffer.allocate(300);
buffer.setAutoExpand(true);
final SipMessageVisitor visitor = new EncoderVisitor(buffer);
message.accept(visitor);
buffer.flip();
return buffer;
}
代码示例来源:origin: org.littleshoot/mina-port
public void encode(IoSession session, Object message,
ProtocolEncoderOutput out) throws Exception {
if (!(message instanceof Serializable)) {
throw new NotSerializableException();
}
ByteBuffer buf = ByteBuffer.allocate(64);
buf.setAutoExpand(true);
buf.putObject(message);
int objectSize = buf.position() - 4;
if (objectSize > maxObjectSize) {
buf.release();
throw new IllegalArgumentException(
"The encoded object is too big: " + objectSize + " (> "
+ maxObjectSize + ')');
}
buf.flip();
out.write(buf);
}
}
代码示例来源:origin: org.littleshoot/mina-port
public void writeObject(Object obj) throws IOException {
ByteBuffer buf = ByteBuffer.allocate(64, false);
buf.setAutoExpand(true);
buf.putObject(obj);
int objectSize = buf.position() - 4;
if (objectSize > maxObjectSize) {
buf.release();
throw new IllegalArgumentException(
"The encoded object is too big: " + objectSize + " (> "
+ maxObjectSize + ')');
}
out.write(buf.array(), 0, buf.position());
buf.release();
}
代码示例来源:origin: org.littleshoot/mina-port
public void encode(IoSession session, Object message,
ProtocolEncoderOutput out) throws Exception {
CharsetEncoder encoder = (CharsetEncoder) session.getAttribute(ENCODER);
if (encoder == null) {
encoder = charset.newEncoder();
session.setAttribute(ENCODER, encoder);
}
String value = message.toString();
ByteBuffer buf = ByteBuffer.allocate(value.length())
.setAutoExpand(true);
buf.putString(value, encoder);
if (buf.position() > maxLineLength) {
throw new IllegalArgumentException("Line length: " + buf.position());
}
buf.putString(delimiter.getValue(), encoder);
buf.flip();
out.write(buf);
}
代码示例来源:origin: org.littleshoot/mina-port
private void storeRemainingInSession(ByteBuffer buf, IoSession session) {
ByteBuffer remainingBuf = ByteBuffer.allocate(buf.capacity());
remainingBuf.setAutoExpand(true);
remainingBuf.order(buf.order());
remainingBuf.put(buf);
session.setAttribute(BUFFER, remainingBuf);
}
}
代码示例来源:origin: org.littleshoot/mina-util
m_buffer.setAutoExpand(true);
代码示例来源:origin: org.littleshoot/mina-port
ByteBuffer tmp = ByteBuffer.allocate(2).setAutoExpand(true);
tmp.putString(delimiter.getValue(), charset.newEncoder());
tmp.flip();
代码示例来源:origin: org.littleshoot/mina-util
m_buffer.setAutoExpand(true);
内容来源于网络,如有侵权,请联系作者删除!