Apache Commons IO sur Android

Je voudrais développer une application Android qui utilise Apache Commons IO, commons-io-2.4-bin.tar.gz.

Et j'obtiens des erreurs, l'un d'eux:

Could not find method java.lang.String.getBytes, referenced from method org.apache.commons.io.IOUtils.toInputStream

Je pense que je n'ai pas à m'en inquiéter, n'est-ce pas?

Est-il une autre spécifique à Android bibliothèque que je peux utiliser à la place d'Apache Commons IO?

Je l'emploie ici:

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.io.IOUtils;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.ResponseErrorHandler;

import android.util.Log;

public class CustomResponseErrorHandler implements ResponseErrorHandler
{

    private ResponseErrorHandler errorHandler = new DefaultResponseErrorHandler();

    @Override
    public void handleError(ClientHttpResponse response) throws IOException
    {
        String theString = IOUtils.toString(response.getBody());
        Log.v("Error Handler", theString);
        CustomException exception = new CustomException();
        Map<String, Object> properties = new HashMap<String, Object>();
        properties.put("code", response.getStatusCode().toString());
        properties.put("body", theString);
        properties.put("header", response.getHeaders());
        exception.setProperties(properties);

        throw exception;
    }

    @Override
    public boolean hasError(ClientHttpResponse response) throws IOException
    {
        return errorHandler.hasError(response);
    }

}

Sur cette ligne:

String theString = IOUtils.toString(response.getBody());

OriginalL'auteur VansFannel | 2013-06-28