本文整理匯總了Java中io.netty.buffer.ByteBuf.writeCharSequence方法的典型用法代碼示例。如果您正苦於以下問題:Java ByteBuf.writeCharSequence方法的具體用法?Java ByteBuf.writeCharSequence怎麽用?Java ByteBuf.writeCharSequence使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.netty.buffer.ByteBuf
的用法示例。
在下文中一共展示了ByteBuf.writeCharSequence方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: write
import io.netty.buffer.ByteBuf; //導入方法依賴的package包/類
@Override
public void write(RakNetByteBuf out) {
super.write(out);
out.writeInt(protocolVersion);
out.writeByte(edition);
ByteBuf buf = Unpooled.buffer();
buf.writeIntLE(chainData.length());
buf.writeCharSequence(chainData, Charsets.UTF_8);
buf.writeIntLE(skinData.length());
buf.writeCharSequence(skinData, Charsets.UTF_8);
out.writeUnsignedVarInt(buf.writerIndex());
out.writeBytes(buf);
buf.release();
}
示例2: encode
import io.netty.buffer.ByteBuf; //導入方法依賴的package包/類
private static void encode(String portal, int rowCount, ByteBuf out) {
int pos = out.writerIndex();
out.writeByte(EXECUTE);
out.writeInt(0);
if (portal != null) {
out.writeCharSequence(portal, StandardCharsets.UTF_8);
}
out.writeByte(0);
out.writeInt(rowCount); // Zero denotes "no limit" maybe for ReadStream<Row>
out.setInt(pos + 1, out.writerIndex() - pos - 1);
}
示例3: encode
import io.netty.buffer.ByteBuf; //導入方法依賴的package包/類
@Override
public ByteBuf encode(Object in) throws IOException {
ByteBuf out = ByteBufAllocator.DEFAULT.buffer();
out.writeCharSequence(in.toString(), charset);
return out;
}
示例4: toBytes
import io.netty.buffer.ByteBuf; //導入方法依賴的package包/類
/**
* Deconstruct your message into the supplied byte buffer
*
* @param buf
*/
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(key.getBytes(StandardCharsets.UTF_8).length);
buf.writeCharSequence(key, StandardCharsets.UTF_8);
}
示例5: encode
import io.netty.buffer.ByteBuf; //導入方法依賴的package包/類
private static void encode(String portal, long statement, List<Object> paramValues, DataType<?>[] dataTypes, ByteBuf out) {
int pos = out.writerIndex();
out.writeByte(BIND);
out.writeInt(0);
if (portal != null) {
out.writeCharSequence(portal, StandardCharsets.UTF_8);
}
out.writeByte(0);
if (statement == 0) {
out.writeByte(0);
} else {
out.writeLong(statement);
}
if(paramValues == null) {
// No parameter formats
out.writeShort(0);
// No parameter values
out.writeShort(0);
} else {
// byte[][] foobar = Util.paramValues(paramValues);
int len = paramValues.size();
out.writeShort(len);
// Parameter formats
for (int c = 0;c < len;c++) {
// for now each format is Binary
out.writeShort(1);
}
out.writeShort(len);
for (int c = 0;c < len;c++) {
Object param = paramValues.get(c);
if (param == null) {
// NULL value
out.writeInt(-1);
} else {
DataType dataType = dataTypes[c];
dataType.binaryEncoder.encode(param, out);
}
}
}
// Result columns are all in Binary format
out.writeShort(1);
out.writeShort(1);
out.setInt(pos + 1, out.writerIndex() - pos - 1);
}
示例6: writeCString
import io.netty.buffer.ByteBuf; //導入方法依賴的package包/類
public static void writeCString(ByteBuf dst, String s, Charset charset) {
dst.writeCharSequence(s, charset);
dst.writeByte(0);
}
示例7: writeCStringUTF8
import io.netty.buffer.ByteBuf; //導入方法依賴的package包/類
public static void writeCStringUTF8(ByteBuf dst, String s) {
dst.writeCharSequence(s, UTF_8);
dst.writeByte(0);
}