Example usage for io.netty.util AsciiString cached

List of usage examples for io.netty.util AsciiString cached

Introduction

In this page you can find the example usage for io.netty.util AsciiString cached.

Prototype

public static AsciiString cached(String string) 

Source Link

Document

Returns an AsciiString containing the given string and retains/caches the input string for later use in #toString() .

Usage

From source file:com.linecorp.armeria.common.HttpHeaderNames.java

License:Apache License

/**
 * Lower-cases and converts the specified header name into an {@link AsciiString}. If {@code name} is
 * a known header name, this method will return a pre-instantiated {@link AsciiString} to reduce
 * the allocation rate of {@link AsciiString}.
 *//*from   w ww.j  a va  2s  .  c  o m*/
public static AsciiString of(String name) {
    name = Ascii.toLowerCase(requireNonNull(name, "name"));
    final AsciiString asciiName = map.get(name);
    return asciiName != null ? asciiName : AsciiString.cached(name);
}

From source file:com.linecorp.armeria.common.HttpStatusClass.java

License:Apache License

HttpStatusClass(int min, int max, String defaultReasonPhrase) {
    this.min = min;
    this.max = max;
    this.defaultReasonPhrase = AsciiString.cached(defaultReasonPhrase);
}