Either you make a method of it and then you can call it in 1 line, or you can use some libraries like OkHttp from square which will let you do that with only 5 indented lines, not 20+.<p><pre><code>    Request request = new Request.Builder()
        .url(&quot;http:&#x2F;&#x2F;example.com&#x2F;upload&quot;)
        .post(RequestBody.create(IMAGE_JPEG, file)
        .build();
    Response response = new OkHttpClient().newCall(request).execute();
</code></pre>
But yes Go&#x27;s standard library is cool, but Java&#x27;s ecosystem is too, and larger.