package com.treasuredata.client;

import com.google.common.base.Function;
import okhttp3.Response;
import okhttp3.ResponseBody;

import java.io.InputStream;

/**
 * Request handler implementations
 */
public class TDHttpRequestHandlers
{
    private TDHttpRequestHandlers()
    {
    }

    public static TDHttpRequestHandler<String> stringContentHandler = new TDHttpRequestHandler<String>()
    {
        @Override
        public String onSuccess(Response response)
                throws Exception
        {
            return response.body().string();
        }
    };

    public static TDHttpRequestHandler<byte[]> byteArrayContentHandler = new TDHttpRequestHandler<byte[]>()
    {
        @Override
        public byte[] onSuccess(Response response)
                throws Exception
        {
            return response.body().bytes();
        }
    };

    public static <Result> TDHttpRequestHandler<Result> newByteStreamHandler(final Function<InputStream, Result> handler)
    {
        return new TDHttpRequestHandler<Result>()
        {
            @Override
            public Result onSuccess(Response response)
                    throws Exception
            {
                try (ResponseBody body = response.body()) {
                    return handler.apply(body.byteStream());
                }
            }
        };
    }
}

@@ -290,32 +290,38 @@
   public static 
+final 
 TDHttpRequestHan
@@ -387,24 +387,24 @@
 r%3CString%3E()%0A
-
     %7B%0A      
@@ -590,16 +590,22 @@
  static 
+final 
 TDHttpRe
@@ -858,32 +858,32 @@
       %7D%0A    %7D;%0A%0A
-
     public stati
@@ -884,16 +884,22 @@
  static 
+final 
 %3CResult%3E

Add final