Example usage for android.util Base64 NO_WRAP

List of usage examples for android.util Base64 NO_WRAP

Introduction

In this page you can find the example usage for android.util Base64 NO_WRAP.

Prototype

int NO_WRAP

To view the source code for android.util Base64 NO_WRAP.

Click Source Link

Document

Encoder flag bit to omit all line terminators (i.e., the output will be on one long line).

Usage

From source file:org.telegram.ui.PassportActivity.java

private String getDocumentHash(SecureDocument document) {
    if (document != null) {
        if (document.secureFile != null && document.secureFile.file_hash != null) {
            return Base64.encodeToString(document.secureFile.file_hash, Base64.NO_WRAP);
        } else if (document.fileHash != null) {
            return Base64.encodeToString(document.fileHash, Base64.NO_WRAP);
        }//  www .  ja  va 2  s  .  c om
    }
    return "";
}

From source file:mobile.tiis.appv2.base.BackboneApplication.java

/**
 * Parsing data from Server after the First login in intervals
 *//*from w ww.j a v  a2  s.co m*/
public void intervalGetChildrenByHealthFacilitySinceLastLogin() {

    String url = WCF_URL + "ChildManagement.svc/GetChildrenByHealthFacilitySinceLastLoginV1?idUser="
            + getLOGGED_IN_USER_ID();
    Log.e("SinceLastLogin", "GetChildrenByHealthFacilitySinceLastLogin url is: " + url);

    ChildCollector2 objects2 = new ChildCollector2();

    try {
        DefaultHttpClient httpClient = new DefaultHttpClient();
        HttpGet httpGet = new HttpGet(url);
        Utils.writeNetworkLogFileOnSD(
                Utils.returnDeviceIdAndTimestamp(getApplicationContext()) + url.toString());
        httpGet.setHeader("Authorization", "Basic " + Base64
                .encodeToString((LOGGED_IN_USERNAME + ":" + LOGGED_IN_USER_PASS).getBytes(), Base64.NO_WRAP));
        HttpResponse httpResponse = httpClient.execute(httpGet);
        InputStream inputStream = httpResponse.getEntity().getContent();
        String response = Utils.getStringFromInputStream(inputStream);
        Log.e("SinceLastLogin", "responce  is: " + response);
        Utils.writeNetworkLogFileOnSD(Utils.returnDeviceIdAndTimestamp(getApplicationContext()) + response);
        ObjectMapper mapper = new ObjectMapper();
        objects2 = mapper.readValue(response, new TypeReference<List<ChildCollector>>() {
        });
    } catch (JsonGenerationException e) {
        e.printStackTrace();
    } catch (JsonMappingException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        Log.d("coze", "before saving to the database");
        if (addChildVaccinationEventVaccinationAppointment(objects2)) {
            Log.d("coze", "about to re login");
            loginRequest();
            objects2 = null; // clearing references so that it can be identified as GC material more easilly;
        }
    }

}