public final class DefaultCharset extends Object
Holds an classloader-wide default charset, that
is then used to encode/decode between Strings and
Byte arrays for Riak's use (see BinaryValue
).
Before 2.0.3, the system used the JRE's default Charset from the
Charset.defaultCharset()
property.
With this class you may change the Riak client to use a different default.
You can set it at startup by providing the desired Charset name with the vm argument
-Dcom.basho.riak.client.DefaultCharset="UTF-8"
, or at runtime
with the static method (see set(Charset)
).
As of 2.0.3 it still defaults to the value provided by
Charset.defaultCharset()
,
but the default is planned to change to "UTF-8" with 2.1.0.
If your JRE default charset is one of "US-ASCII", "UTF-8", or "ISO-8859-1", this change should not affect you.
If your JRE default charset is one of "UTF-16", "UTF-16BE", or "UTF-16LE", you will need to set that default on the command line or after application startup once you upgrade.
Modifier and Type | Method and Description |
---|---|
static Charset |
get()
Get the current classloader-wide default Charset for the Riak client.
|
static void |
set(Charset charset)
Set the classloader-wide default Charset for the Riak client.
|
public static Charset get()
public static void set(Charset charset)
charset
- The charset to set the classloader-wide default to.Copyright © 2016. All rights reserved.