List of usage examples for io.netty.util AsciiString AsciiString
public AsciiString(CharSequence value, Charset charset, int start, int length)
From source file:com.linecorp.armeria.server.http.tomcat.TomcatService.java
License:Apache License
private static AsciiString toHeaderName(MessageBytes value) { switch (value.getType()) { case MessageBytes.T_BYTES: { final ByteChunk chunk = value.getByteChunk(); return new AsciiString(chunk.getBuffer(), chunk.getOffset(), chunk.getLength(), true); }/*from w w w. ja va 2s .c o m*/ case MessageBytes.T_CHARS: { final CharChunk chunk = value.getCharChunk(); return new AsciiString(chunk.getBuffer(), chunk.getOffset(), chunk.getLength()); } case MessageBytes.T_STR: { return new AsciiString(value.getString()); } } return null; }
From source file:com.linecorp.armeria.server.http.tomcat.TomcatServiceInvocationHandler.java
License:Apache License
private static CharSequence convertMessageBytes(MessageBytes value) { if (value.getType() != MessageBytes.T_BYTES) { return value.toString(); }/*w w w.j a va 2 s . com*/ final ByteChunk chunk = value.getByteChunk(); return new AsciiString(chunk.getBuffer(), chunk.getOffset(), chunk.getLength(), false); }
From source file:com.linecorp.armeria.server.tomcat.TomcatService.java
License:Apache License
@Nullable private static AsciiString toHeaderName(MessageBytes value) { switch (value.getType()) { case MessageBytes.T_BYTES: { final ByteChunk chunk = value.getByteChunk(); return new AsciiString(chunk.getBuffer(), chunk.getOffset(), chunk.getLength(), true); }//w ww.ja v a 2 s. c o m case MessageBytes.T_CHARS: { final CharChunk chunk = value.getCharChunk(); return new AsciiString(chunk.getBuffer(), chunk.getOffset(), chunk.getLength()); } case MessageBytes.T_STR: { return HttpHeaderNames.of(value.getString()); } } return null; }