类 GsonBuilderUtils
- java.lang.Object
- org.springframework.http.converter.json.GsonBuilderUtils
public abstract class GsonBuilderUtils extends Object
A simple utility class for obtaining a Google Gson 2.xGsonBuilder
which Base64-encodesbyte[]
properties when reading and writing JSON.- 从以下版本开始:
- 4.1
- 作者:
- Juergen Hoeller, Roy Clarkson
- 另请参阅:
GsonFactoryBean.setBase64EncodeByteArrays(boolean)
,Base64Utils
构造器概要
构造器 构造器 说明 GsonBuilderUtils()
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static com.google.gson.GsonBuilder
gsonBuilderWithBase64EncodedByteArrays()
Obtain aGsonBuilder
which Base64-encodesbyte[]
properties when reading and writing JSON.
构造器详细资料
GsonBuilderUtils
public GsonBuilderUtils()
方法详细资料
gsonBuilderWithBase64EncodedByteArrays
public static com.google.gson.GsonBuilder gsonBuilderWithBase64EncodedByteArrays()
Obtain aGsonBuilder
which Base64-encodesbyte[]
properties when reading and writing JSON.A custom
TypeAdapter
will be registered viaGsonBuilder.registerTypeHierarchyAdapter(Class, Object)
which serializes abyte[]
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.