All Downloads are FREE. Search and download functionalities are using the official Maven repository.

e.aml.org.aml.raml2java.0.0.8.source-code.ByteArrayToBase64TypeAdapter.tpl Maven / Gradle / Ivy

package {packageName};


import java.io.IOException;
import java.util.Base64;

import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;

public class ByteArrayToBase64TypeAdapter extends TypeAdapter {


		public void write(JsonWriter out, byte[] value) throws IOException {
			out.value(Base64.getEncoder().encodeToString(value));
		}

		public byte[] read(JsonReader in) throws IOException {
			return Base64.getDecoder().decode(in.nextString());
		}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy