public abstract class GsonBuilderUtils
extends java.lang.Object
GsonBuilder
which Base64-encodes byte[]
properties when reading and writing JSON.GsonFactoryBean.setBase64EncodeByteArrays(boolean)
,
Base64Utils
Constructor and Description |
---|
GsonBuilderUtils() |
Modifier and Type | Method and Description |
---|---|
static com.google.gson.GsonBuilder |
gsonBuilderWithBase64EncodedByteArrays()
Obtain a
GsonBuilder which Base64-encodes byte[]
properties when reading and writing JSON. |
public static com.google.gson.GsonBuilder gsonBuilderWithBase64EncodedByteArrays()
GsonBuilder
which Base64-encodes byte[]
properties when reading and writing JSON.
A custom TypeAdapter
will be registered via
GsonBuilder.registerTypeHierarchyAdapter(Class, Object)
which
serializes a byte[]
property to and from a Base64-encoded String
instead of a JSON array.
NOTE: Use of this option requires the presence of the
Apache Commons Codec library on the classpath when running on Java 6 or 7.
On Java 8, the standard Base64
facility is used instead.