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

com.scarabsoft.jrest.converter.body.StringBodyConverter Maven / Gradle / Ivy

There is a newer version: 1.0.6
Show newest version
package com.scarabsoft.jrest.converter.body;

import java.io.UnsupportedEncodingException;

public final class StringBodyConverter implements BodyConverter {

    @Override
    public byte[] toBody(Object obj) throws UnsupportedEncodingException {
        if (obj == null) {
            return new byte[0];
        }
        return obj.toString().getBytes("UTF-8");
    }

    @Override
    public String getMimetype() {
        return "text/plain";
    }
};




© 2015 - 2025 Weber Informatics LLC | Privacy Policy