void trialHeadMethodForInstanceLength() throws IOException {
        final DownloadConnection connection = OkDownload.with().connectionFactory()
                .create(task.getUrl());
        final DownloadListener listener = OkDownload.with().callbackDispatcher().dispatch();
        try {
            connection.setRequestMethod(METHOD_HEAD);
            final Map<String, List<String>> userHeader = task.getHeaderMapFields();
            if (userHeader != null)  Util.addUserRequestHeaderField(userHeader, connection);

            listener.connectTrialStart(task, connection.getRequestProperties());
            final DownloadConnection.Connected connectedForContentLength = connection.execute();
            listener.connectTrialEnd(task, connectedForContentLength.getResponseCode(),
                    connectedForContentLength.getResponseHeaderFields());

            this.instanceLength = Util.parseContentLength(
                    connectedForContentLength.getResponseHeaderField(CONTENT_LENGTH));
        } finally {
            connection.release();
        }
    }
void trialHeadMethodForInstanceLength ( ) throws IOException { final DownloadConnection connection = OkDownload . with ( ) . connectionFactory ( ) . create ( task . getUrl ( ) ) ; final DownloadListener listener = OkDownload . with ( ) . callbackDispatcher ( ) . dispatch ( ) ; try { connection . setRequestMethod ( METHOD_HEAD ) ; final Map < String , List < String > > userHeader = task . getHeaderMapFields ( ) ; if ( userHeader != null ) Util . addUserRequestHeaderField ( userHeader , connection ) ; listener . connectTrialStart ( task , connection . getRequestProperties ( ) ) ; final DownloadConnection . Connected connectedForContentLength = connection . execute ( ) ; listener . connectTrialEnd ( task , connectedForContentLength . getResponseCode ( ) , connectedForContentLength . getResponseHeaderFields ( ) ) ; this . instanceLength = Util . parseContentLength ( connectedForContentLength . getResponseHeaderField ( CONTENT_LENGTH ) ) ; } finally { connection . release ( ) ; } }
right one.