public enum Separator extends Enum<Separator>
| Enum Constant and Description |
|---|
QUALIFIERS
separator in key or column qualifier fields.
|
SPACE
separator in values, often used to avoid having these in qualifiers and
names.
|
TAB
separator in values, often used to avoid having these in qualifiers and
names.
|
VALUES
separator in values, and/or compound key/column qualifier fields.
|
| Modifier and Type | Field and Description |
|---|---|
static byte[] |
EMPTY_BYTES
empty bytes.
|
static String |
EMPTY_STRING
empty string.
|
static int |
VARIABLE_SIZE
Indicator for variable size of an individual segment in a split.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
decode(byte[] token,
Separator... separators)
Decode the given separators in the token with their decoding equivalents.
|
String |
decode(String token)
Decode the token encoded using
encode(String). |
static String |
decode(String token,
Separator... separators)
Decode the given separators in the token with their decoding equivalents.
|
String |
encode(String token)
Used to make token safe to be used with this separator without collisions.
|
static byte[] |
encode(String token,
Separator... separators)
Encode the given separators in the token with their encoding equivalents.
|
String |
getValue() |
byte[] |
join(byte[]... components)
Returns a single byte array containing all of the individual arrays
components separated by this separator.
|
String |
joinEncoded(Iterable<?> items)
Concatenates items (as String), using this separator.
|
String |
joinEncoded(String... items)
Concatenates items (as String), using this separator.
|
byte[][] |
split(byte[] source)
Splits the source array into multiple array segments using this separator,
as many times as splits are found.
|
byte[][] |
split(byte[] source,
int limit)
Splits the source array into multiple array segments using this separator,
up to a maximum of count items.
|
byte[][] |
split(byte[] source,
int[] sizes)
Splits the source array into multiple array segments using this separator.
|
Collection<String> |
splitEncoded(String compoundValue) |
static Separator |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Separator[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Separator QUALIFIERS
public static final Separator VALUES
public static final Separator SPACE
public static final Separator TAB
public static final int VARIABLE_SIZE
public static final String EMPTY_STRING
public static final byte[] EMPTY_BYTES
public static Separator[] values()
for (Separator c : Separator.values()) System.out.println(c);
public static Separator valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic String getValue()
public String encode(String token)
decode(String) for it to be
decoded correctly.
If you need to encode a given string for multiple separators,
encode(String, Separator...) should be used over successive
invocations of this method. It will result in a more compact version of the
encoded value.
token - Token to be encoded.public String decode(String token)
encode(String). It must be
used for the result encoded with encode(String) to be able to
recover the original.token - Token to be decoded.public static byte[] encode(String token, Separator... separators)
decode(byte[], Separator...) or
decode(String, Separator...) with the same separators for it to be
decoded correctly.
If you need to encode a given string for multiple separators, this form of
encoding should be used over successive invocations of
encode(String). It will result in a more compact version of the
encoded value.
token - containing possible separators that need to be encoded.separators - to be encoded in the token with their URLEncoding
equivalent.public static String decode(byte[] token, Separator... separators)
encode(String, Separator...) with the same separators to be able
to recover the original.token - containing possible separators that need to be encoded.separators - to be encoded in the token with their URLEncoding
equivalent.public static String decode(String token, Separator... separators)
encode(String, Separator...) with the same separators to be able
to recover the original.token - containing possible separators that need to be encoded.separators - to be encoded in the token with their URLEncoding
equivalent.public byte[] join(byte[]... components)
components - Byte array components to be joined together.public String joinEncoded(String... items)
items - Items join, toString() will be called in each item.
Any occurrence of the separator in the individual strings will be
first encoded. Cannot be null.splitEncoded(String)public String joinEncoded(Iterable<?> items)
items - Items join, toString() will be called in each item.
Any occurrence of the separator in the individual strings will be
first encoded. Cannot be null.splitEncoded(String)public Collection<String> splitEncoded(String compoundValue)
compoundValue - containing individual values separated by this
separator, which have that separator encoded.public byte[][] split(byte[] source,
int limit)
source - to be splitlimit - on how many segments are supposed to be returned. A
non-positive value indicates no limit on number of segments.public byte[][] split(byte[] source,
int[] sizes)
source - byte array to be split.sizes - sizes of relative components/segments.public byte[][] split(byte[] source)
source - byte array to be splitCopyright © 2008–2024 Apache Software Foundation. All rights reserved.