本文整理了Java中io.netty.buffer.ByteBuf.writeCharSequence()
方法的一些代码示例,展示了ByteBuf.writeCharSequence()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.writeCharSequence()
方法的具体详情如下:
包路径:io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:writeCharSequence
[英]Writes the specified CharSequence at the current writerIndex and increases the writerIndex by the written bytes. in this buffer.
[中]
代码示例来源:origin: netty/netty
@Override
public void writeBytes(String s) throws IOException {
buffer.writeCharSequence(s, CharsetUtil.US_ASCII);
}
代码示例来源:origin: netty/netty
@Override
public int writeCharSequence(CharSequence sequence, Charset charset) {
return buf.writeCharSequence(sequence, charset);
}
代码示例来源:origin: netty/netty
@Override
public int writeCharSequence(CharSequence sequence, Charset charset) {
return buf.writeCharSequence(sequence, charset);
}
代码示例来源:origin: redisson/redisson
@Override
public void writeBytes(String s) throws IOException {
buffer.writeCharSequence(s, CharsetUtil.US_ASCII);
}
代码示例来源:origin: redisson/redisson
@Override
public int writeCharSequence(CharSequence sequence, Charset charset) {
return buf.writeCharSequence(sequence, charset);
}
代码示例来源:origin: redisson/redisson
@Override
public int writeCharSequence(CharSequence sequence, Charset charset) {
return buf.writeCharSequence(sequence, charset);
}
代码示例来源:origin: redisson/redisson
@Override
public ByteBuf encode(Object in) throws IOException {
ByteBuf out = ByteBufAllocator.DEFAULT.buffer();
out.writeCharSequence(in.toString(), charset);
return out;
}
};
代码示例来源:origin: redisson/redisson
@Override
public ByteBuf encode(Object in) throws IOException {
ByteBuf out = ByteBufAllocator.DEFAULT.buffer();
out.writeCharSequence(in.toString(), charset);
return out;
}
};
代码示例来源:origin: redisson/redisson
private void writeArgument(ByteBuf out, byte[] arg) {
out.writeByte(BYTES_PREFIX);
out.writeCharSequence(Long.toString(arg.length), CharsetUtil.US_ASCII);
out.writeBytes(CRLF);
out.writeBytes(arg);
out.writeBytes(CRLF);
}
代码示例来源:origin: redisson/redisson
private void writeArgument(ByteBuf out, byte[] arg) {
out.writeByte(BYTES_PREFIX);
out.writeCharSequence(Long.toString(arg.length), CharsetUtil.US_ASCII);
out.writeBytes(CRLF);
out.writeBytes(arg);
out.writeBytes(CRLF);
}
代码示例来源:origin: redisson/redisson
private void writeArgument(ByteBuf out, ByteBuf arg) {
out.writeByte(BYTES_PREFIX);
out.writeCharSequence(Long.toString(arg.readableBytes()), CharsetUtil.US_ASCII);
out.writeBytes(CRLF);
out.writeBytes(arg, arg.readerIndex(), arg.readableBytes());
out.writeBytes(CRLF);
}
代码示例来源:origin: redisson/redisson
private void writeArgument(ByteBuf out, ByteBuf arg) {
out.writeByte(BYTES_PREFIX);
out.writeCharSequence(Long.toString(arg.readableBytes()), CharsetUtil.US_ASCII);
out.writeBytes(CRLF);
out.writeBytes(arg, arg.readerIndex(), arg.readableBytes());
out.writeBytes(CRLF);
}
代码示例来源:origin: Netflix/zuul
@Override
public ChannelFuture sendPing(ChannelHandlerContext ctx) {
final ByteBuf newBuff = ctx.alloc().buffer();
newBuff.ensureWritable(SSE_PING.length());
newBuff.writeCharSequence(SSE_PING, Charsets.UTF_8);
return ctx.channel().writeAndFlush(newBuff);
}
代码示例来源:origin: wildfly/wildfly
private static ByteBuf newBinaryData(int statusCode, String reasonText) {
if (reasonText == null) {
reasonText = StringUtil.EMPTY_STRING;
}
ByteBuf binaryData = Unpooled.buffer(2 + reasonText.length());
binaryData.writeShort(statusCode);
if (!reasonText.isEmpty()) {
binaryData.writeCharSequence(reasonText, CharsetUtil.UTF_8);
}
binaryData.readerIndex(0);
return binaryData;
}
代码示例来源:origin: Netflix/zuul
@Override
public ChannelFuture sendPushMessage(ChannelHandlerContext ctx, ByteBuf mesg) {
final ByteBuf newBuff = ctx.alloc().buffer();
newBuff.ensureWritable(SSE_PREAMBLE.length());
newBuff.writeCharSequence(SSE_PREAMBLE, Charsets.UTF_8);
newBuff.ensureWritable(mesg.writableBytes());
newBuff.writeBytes(mesg);
newBuff.ensureWritable(SSE_TERMINATION.length());
newBuff.writeCharSequence(SSE_TERMINATION, Charsets.UTF_8);
mesg.release();
return ctx.channel().writeAndFlush(newBuff);
}
代码示例来源:origin: wildfly/wildfly
void encode(ByteBuf buf) {
if (bytes == null) {
ByteBufUtil.copy(codeAsText, buf);
buf.writeByte(SP);
buf.writeCharSequence(reasonPhrase, CharsetUtil.US_ASCII);
} else {
buf.writeBytes(bytes);
}
}
}
代码示例来源:origin: wildfly/wildfly
@Deprecated
public static void encodeAscii(CharSequence seq, ByteBuf buf) {
if (seq instanceof AsciiString) {
ByteBufUtil.copy((AsciiString) seq, 0, buf, seq.length());
} else {
buf.writeCharSequence(seq, CharsetUtil.US_ASCII);
}
}
代码示例来源:origin: wildfly/wildfly
private static ByteBuf encodeFrame(StompHeadersSubframe frame, ChannelHandlerContext ctx) {
ByteBuf buf = ctx.alloc().buffer();
buf.writeCharSequence(frame.command().toString(), CharsetUtil.US_ASCII);
buf.writeByte(StompConstants.LF);
AsciiHeadersEncoder headersEncoder = new AsciiHeadersEncoder(buf, SeparatorType.COLON, NewlineType.LF);
for (Entry<CharSequence, CharSequence> entry : frame.headers()) {
headersEncoder.encode(entry);
}
buf.writeByte(StompConstants.LF);
return buf;
}
}
代码示例来源:origin: Netflix/zuul
@Override
public ChannelFuture sendPing(ChannelHandlerContext ctx) {
final ByteBuf newBuff = ctx.alloc().buffer();
newBuff.ensureWritable(SSE_PING.length());
newBuff.writeCharSequence(SSE_PING, Charsets.UTF_8);
return ctx.channel().writeAndFlush(newBuff);
}
代码示例来源:origin: Netflix/zuul
@Override
public ChannelFuture sendPushMessage(ChannelHandlerContext ctx, ByteBuf mesg) {
final ByteBuf newBuff = ctx.alloc().buffer();
newBuff.ensureWritable(SSE_PREAMBLE.length());
newBuff.writeCharSequence(SSE_PREAMBLE, Charsets.UTF_8);
newBuff.ensureWritable(mesg.writableBytes());
newBuff.writeBytes(mesg);
newBuff.ensureWritable(SSE_TERMINATION.length());
newBuff.writeCharSequence(SSE_TERMINATION, Charsets.UTF_8);
mesg.release();
return ctx.channel().writeAndFlush(newBuff);
}
内容来源于网络,如有侵权,请联系作者删除!