public final class NcnameCodec extends Object implements UuidCodec<String>
A UUID NCName is a shorter string representation that conforms to the constraints of various other identifiers such as NCName in XML documents.
The NcnameCodec turns a UUID into a string that does not start with
digits (0-9). But due to the default base-64-url encoding, it is case
sensitive and may contain '-' and '_'.
The Base32Codec can be passed to the NcnameCodec constructor
to generate base-32 NCNames. Due to the base-32 alphabet, it is case
insensitive and it contains only letters (a-zA-Z) and digits (2-7). This
encoding substitution can be done to avoid the characters '-' and '_' of the
base-64-url encoding, but it makes the NCName case insensitive.
The transformation scheme is outlined in this RFC: https://tools.ietf.org/html/draft-taylor-uuid-ncname-00. The draft describes schemes for base-64-url and base-32.
SlugCodec and NcnameCodec are very similar. The difference
between the two is the bit shift they do with the original UUID to transform
it into a string.
| 限定符和类型 | 字段和说明 |
|---|---|
static NcnameCodec |
INSTANCE
A shared immutable instance using `base64url`
|
| 构造器和说明 |
|---|
NcnameCodec() |
NcnameCodec(BaseNCodec codec) |
public static final NcnameCodec INSTANCE
public NcnameCodec()
public NcnameCodec(BaseNCodec codec)
Copyright © 2024. All rights reserved.