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

io.github.icodegarden.nutrient.lang.serialization.StringDeserializer Maven / Gradle / Ivy

There is a newer version: 3.0.2
Show newest version
package io.github.icodegarden.nutrient.lang.serialization;

import java.io.UnsupportedEncodingException;

/**
 * 
 * @author Fangfang.Xu
 *
 */
public class StringDeserializer implements Deserializer {
	private String encoding = "UTF8";

	@Override
	public String deserialize(byte[] data) throws SerializationException {
		try {
			if (data == null)
				return null;
			else
				return new String(data, encoding);
		} catch (UnsupportedEncodingException e) {
			throw new SerializationException(
					"Error when deserializing byte[] to string due to unsupported encoding " + encoding);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy