app/src/main/java/com/example/android/popularmoviesapp/sync/Syncer.java
protected void sync() {

        // Declared outside in order to be closed in finally block
        HttpURLConnection urlConnection = null;
        BufferedReader reader = null;

        try {
            final URL url = buildUrl();
//            Log.d(LOG_TAG, "url: " + url);
            urlConnection = connect(url);
            reader = persistDataFromServer(urlConnection);
        } catch (IOException | JSONException e) {
            Log.e(LOG_TAG, e.getMessage(), e);
        } finally {
            disconnectAndClose(urlConnection, reader);
        }
    }
/**
     * Gets video data with a http request.
     * Parses data as a JSON string
     * and persists it.
     */
Gets video data with a http request.
Parses data as a JSON string
and persists it.
Gets video data with a http request . Parses data as a JSON string and persists it .
protected void sync() {
        HttpURLConnection urlConnection = null;
        BufferedReader reader = null;
        try {
            final URL url = buildUrl();
            urlConnection = connect(url);
            reader = persistDataFromServer(urlConnection);
        } catch (IOException | JSONException e) {
            Log.e(LOG_TAG, e.getMessage(), e);
        } finally {
            disconnectAndClose(urlConnection, reader);
        }
    }
protected void sync ( ) { HttpURLConnection urlConnection = null ; BufferedReader reader = null ; try { final URL url = buildUrl ( ) ; urlConnection = connect ( url ) ; reader = persistDataFromServer ( urlConnection ) ; } catch ( IOException | JSONException e ) { Log . e ( LOG_TAG , e . getMessage ( ) , e ) ; } finally { disconnectAndClose ( urlConnection , reader ) ; } }
Gets video data with a http request.
Gets video data with a http request .
// Declared outside in order to be closed in finally block //            Log.d(LOG_TAG, "url: " + url);