public class NlsString extends Object implements Comparable<NlsString>, Cloneable
character set and
SqlCollation. It is immutable.| Constructor and Description |
|---|
NlsString(org.apache.calcite.avatica.util.ByteString bytesValue,
String charsetName,
@Nullable SqlCollation collation)
Creates a string in a specified character set.
|
NlsString(String stringValue,
@Nullable String charsetName,
@Nullable SqlCollation collation)
Easy constructor for Java string.
|
| Modifier and Type | Method and Description |
|---|---|
String |
asSql(boolean prefix,
boolean suffix)
As
asSql(boolean, boolean, SqlDialect) but with SQL standard
dialect. |
String |
asSql(boolean prefix,
boolean suffix,
SqlDialect dialect)
Returns the string quoted for SQL, for example
_ISO-8859-1'is it a
plane? no it''s superman!'. |
Object |
clone() |
int |
compareTo(NlsString other) |
static NlsString |
concat(List<NlsString> args)
Concatenates some
NlsString objects. |
NlsString |
copy(String value)
Creates a copy of this
NlsString with different content but same
charset and collation. |
boolean |
equals(@Nullable Object obj) |
@Nullable Charset |
getCharset() |
@Nullable String |
getCharsetName() |
@Nullable SqlCollation |
getCollation() |
String |
getValue() |
@Nullable org.apache.calcite.avatica.util.ByteString |
getValueBytes()
Returns the value as a
ByteString. |
int |
hashCode() |
NlsString |
rtrim()
Returns a string the same as this but with spaces trimmed from the
right.
|
String |
toString()
Returns the string quoted for SQL, for example
_ISO-8859-1'is it a
plane? no it''s superman!'. |
public NlsString(org.apache.calcite.avatica.util.ByteString bytesValue,
String charsetName,
@Nullable SqlCollation collation)
bytesValue - Byte array constant, must not be nullcharsetName - Name of the character set, must not be nullcollation - Collation, may be nullIllegalCharsetNameException - If the given charset name is illegalUnsupportedCharsetException - If no support for the named charset
is available in this instance of the Java virtual machineRuntimeException - If the given value cannot be represented in the
given charsetpublic NlsString(String stringValue, @Nullable String charsetName, @Nullable SqlCollation collation)
stringValue - String constant, must not be nullcharsetName - Name of the character set, may be nullcollation - Collation, may be nullIllegalCharsetNameException - If the given charset name is illegalUnsupportedCharsetException - If no support for the named charset
is available in this instance of the Java virtual machineRuntimeException - If the given value cannot be represented in the
given charsetpublic int compareTo(NlsString other)
compareTo in interface Comparable<NlsString>@Pure public @Nullable String getCharsetName()
@Pure public @Nullable Charset getCharset()
@Pure public @Nullable SqlCollation getCollation()
public String getValue()
public NlsString rtrim()
public String asSql(boolean prefix, boolean suffix)
asSql(boolean, boolean, SqlDialect) but with SQL standard
dialect.public String asSql(boolean prefix, boolean suffix, SqlDialect dialect)
_ISO-8859-1'is it a
plane? no it''s superman!'.prefix - if true, prefix the character set namesuffix - if true, suffix the collation clausedialect - Dialectpublic String toString()
_ISO-8859-1'is it a
plane? no it''s superman!'.public static NlsString concat(List<NlsString> args)
NlsString objects. The result has the charset
and collation of the first element. The other elements must have matching
(or null) charset and collation. Concatenates all at once, not pairwise,
to avoid string copies.args - array of NlsString to be concatenatedpublic NlsString copy(String value)
NlsString with different content but same
charset and collation.@Pure public @Nullable org.apache.calcite.avatica.util.ByteString getValueBytes()
ByteString.Copyright © 2012-2022 Apache Software Foundation. All Rights Reserved.