Example usage for android.app.backup BackupDataInputStream read

List of usage examples for android.app.backup BackupDataInputStream read

Introduction

In this page you can find the example usage for android.app.backup BackupDataInputStream read.

Prototype

public int read(byte[] b, int offset, int size) throws IOException 

Source Link

Document

Read up to size bytes of data into a byte array, beginning at position offset within the array.

Usage

From source file:com.csipsimple.backup.SipProfilesHelper.java

/**
 * Read data from the input stream//w  ww.j av  a 2 s. c  o m
 * 
 * @param data the input stream
 * @return the data
 * @throws IOException I/O error
 */
private String readData(BackupDataInputStream data) throws IOException {
    String dataS;
    byte[] buf = new byte[data.size()];
    data.read(buf, 0, buf.length);
    ByteArrayInputStream bais = new ByteArrayInputStream(buf);
    DataInputStream dis = new DataInputStream(bais);
    dataS = dis.readUTF();
    dis.close();
    bais.close();
    return dataS;
}