private static void writeAscii(ByteBuf buf, int offset, CharSequence value) { if (value instanceof AsciiString) { ByteBufUtil.copy((AsciiString) value, 0, buf, offset, value.length()); } else { buf.setCharSequence(offset, value, CharsetUtil.US_ASCII); } } }
/** * Copies the all content of {@code src} to a {@link ByteBuf} using {@link ByteBuf#writeBytes(byte[], int, int)}. * * @param src the source string to copy * @param dst the destination buffer */ public static void copy(AsciiString src, ByteBuf dst) { copy(src, 0, dst, src.length()); }
private static void writeAscii(ByteBuf buf, int offset, CharSequence value) { if (value instanceof AsciiString) { ByteBufUtil.copy((AsciiString) value, 0, buf, offset, value.length()); } else { buf.setCharSequence(offset, value, CharsetUtil.US_ASCII); } } }
private static void writeAscii(ByteBuf buf, int offset, CharSequence value) { if (value instanceof AsciiString) { ByteBufUtil.copy((AsciiString) value, 0, buf, offset, value.length()); } else { buf.setCharSequence(offset, value, CharsetUtil.US_ASCII); } }
/** * Copies the all content of {@code src} to a {@link ByteBuf} using {@link ByteBuf#writeBytes(byte[], int, int)}. * * @param src the source string to copy * @param dst the destination buffer */ public static void copy(AsciiString src, ByteBuf dst) { copy(src, 0, dst, src.length()); }
@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); } }
private static void writeAscii(ByteBuf buf, int offset, CharSequence value) { if (value instanceof AsciiString) { ByteBufUtil.copy((AsciiString) value, 0, buf, offset, value.length()); } else { buf.setCharSequence(offset, value, CharsetUtil.US_ASCII); } } }
void encode(ByteBuf buf) { if (bytes == null) { ByteBufUtil.copy(codeAsText, buf); buf.writeByte(SP); buf.writeCharSequence(reasonPhrase, CharsetUtil.US_ASCII); } else { buf.writeBytes(bytes); } } }
/** * Copies the all content of {@code src} to a {@link ByteBuf} using {@link ByteBuf#writeBytes(byte[], int, int)}. * * @param src the source string to copy * @param dst the destination buffer */ public static void copy(AsciiString src, ByteBuf dst) { copy(src, 0, dst, src.length()); }
private static void writeAscii(ByteBuf buf, int offset, CharSequence value) { if (value instanceof AsciiString) { ByteBufUtil.copy((AsciiString) value, 0, buf, offset, value.length()); } else { buf.setCharSequence(offset, value, CharsetUtil.US_ASCII); } } }
private static void writeAscii(ByteBuf buf, int offset, CharSequence value, int valueLen) { if (value instanceof AsciiString) { ByteBufUtil.copy((AsciiString) value, 0, buf, offset, valueLen); } else { writeCharSequence(buf, offset, value, valueLen); } }
@Override protected void encodeInitialLine(ByteBuf buf, HttpRequest request) throws Exception { ByteBufUtil.copy(request.method().asciiName(), buf);
@Override protected void encodeInitialLine(final ByteBuf buf, final HttpMessage message) throws Exception { if (message instanceof HttpRequest) { HttpRequest request = (HttpRequest) message; ByteBufUtil.copy(request.method().asciiName(), buf); buf.writeByte(SP); buf.writeCharSequence(request.uri(), CharsetUtil.UTF_8); buf.writeByte(SP); buf.writeCharSequence(request.protocolVersion().toString(), CharsetUtil.US_ASCII); ByteBufUtil.writeShortBE(buf, CRLF_SHORT); } else if (message instanceof HttpResponse) { HttpResponse response = (HttpResponse) message; buf.writeCharSequence(response.protocolVersion().toString(), CharsetUtil.US_ASCII); buf.writeByte(SP); ByteBufUtil.copy(response.status().codeAsText(), buf); buf.writeByte(SP); buf.writeCharSequence(response.status().reasonPhrase(), CharsetUtil.US_ASCII); ByteBufUtil.writeShortBE(buf, CRLF_SHORT); } else { throw new UnsupportedMessageTypeException("Unsupported type " + StringUtil.simpleClassName(message)); } } }
private static void writeAscii(ByteBuf buf, int offset, CharSequence value) { if (value instanceof AsciiString) { ByteBufUtil.copy((AsciiString) value, 0, buf, offset, value.length()); } else { buf.setCharSequence(offset, value, CharsetUtil.US_ASCII); } }
/** * Copies the all content of {@code src} to a {@link ByteBuf} using {@link ByteBuf#writeBytes(byte[], int, int)}. * * @param src the source string to copy * @param dst the destination buffer */ public static void copy(AsciiString src, ByteBuf dst) { copy(src, 0, dst, src.length()); }
void encode(ByteBuf buf) { if (bytes == null) { ByteBufUtil.copy(codeAsText, buf); buf.writeByte(SP); buf.writeCharSequence(reasonPhrase, CharsetUtil.US_ASCII); } else { buf.writeBytes(bytes); } } }
/** * Copies the all content of {@code src} to a {@link ByteBuf} using {@link ByteBuf#writeBytes(byte[], int, int)}. * * @param src the source string to copy * @param dst the destination buffer */ public static void copy(AsciiString src, ByteBuf dst) { copy(src, 0, dst, src.length()); }
private static void writeAscii(ByteBuf buf, int offset, CharSequence value, int valueLen) { if (value instanceof AsciiString) { ByteBufUtil.copy((AsciiString) value, 0, buf, offset, valueLen); } else { writeCharSequence(buf, offset, value, valueLen); } }
void encode(ByteBuf buf) { if (bytes == null) { ByteBufUtil.copy(codeAsText, buf); buf.writeByte(SP); buf.writeCharSequence(reasonPhrase, CharsetUtil.US_ASCII); } else { buf.writeBytes(bytes); } } }
/** * Copies the all content of {@code src} to a {@link ByteBuf} using {@link ByteBuf#writeBytes(byte[], int, int)}. * * @param src the source string to copy * @param dst the destination buffer */ public static void copy(AsciiString src, ByteBuf dst) { copy(src, 0, dst, src.length()); }