當前位置: 首頁>>代碼示例>>Java>>正文


Java ByteBuf.writeCharSequence方法代碼示例

本文整理匯總了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();
}
 
開發者ID:MagicDroidX,項目名稱:RakNetty,代碼行數:17,代碼來源:LoginPacket.java

示例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);
}
 
開發者ID:vietj,項目名稱:reactive-pg-client,代碼行數:12,代碼來源:Execute.java

示例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;
     }
 
開發者ID:qq1588518,項目名稱:JRediClients,代碼行數:7,代碼來源:StringCodec.java

示例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);
}
 
開發者ID:MinecraftPangu,項目名稱:Pangu,代碼行數:11,代碼來源:KeyMessage.java

示例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);
}
 
開發者ID:vietj,項目名稱:reactive-pg-client,代碼行數:47,代碼來源:Bind.java

示例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);
}
 
開發者ID:vietj,項目名稱:reactive-pg-client,代碼行數:5,代碼來源:Util.java

示例7: writeCStringUTF8

import io.netty.buffer.ByteBuf; //導入方法依賴的package包/類
public static void writeCStringUTF8(ByteBuf dst, String s) {
  dst.writeCharSequence(s, UTF_8);
  dst.writeByte(0);
}
 
開發者ID:vietj,項目名稱:reactive-pg-client,代碼行數:5,代碼來源:Util.java


注:本文中的io.netty.buffer.ByteBuf.writeCharSequence方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。