com.carrotsearch.ant.tasks.junit4.events.json
Class JsonByteArrayAdapter

java.lang.Object
  extended by com.carrotsearch.ant.tasks.junit4.events.json.JsonByteArrayAdapter
All Implemented Interfaces:
com.google.gson.JsonDeserializer<byte[]>, com.google.gson.JsonSerializer<byte[]>

public class JsonByteArrayAdapter
extends Object
implements com.google.gson.JsonSerializer<byte[]>, com.google.gson.JsonDeserializer<byte[]>

Serialize byte array to portable ASCII. This is used primarily to carry system streams and since the encoding (or correctness) of these is generally not known we encode them as binary to recover them faithfully.


Constructor Summary
JsonByteArrayAdapter()
           
 
Method Summary
 byte[] deserialize(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context)
           
 com.google.gson.JsonElement serialize(byte[] src, Type typeOfSrc, com.google.gson.JsonSerializationContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonByteArrayAdapter

public JsonByteArrayAdapter()
Method Detail

serialize

public com.google.gson.JsonElement serialize(byte[] src,
                                             Type typeOfSrc,
                                             com.google.gson.JsonSerializationContext context)
Specified by:
serialize in interface com.google.gson.JsonSerializer<byte[]>

deserialize

public byte[] deserialize(com.google.gson.JsonElement json,
                          Type typeOfT,
                          com.google.gson.JsonDeserializationContext context)
                   throws com.google.gson.JsonParseException
Specified by:
deserialize in interface com.google.gson.JsonDeserializer<byte[]>
Throws:
com.google.gson.JsonParseException


Copyright © 2011-2012 Carrot Search s.c.. All Rights Reserved.