Code example for BackupDataOutput

Methods: writeEntityData, writeEntityHeader

0
        // Write structured data 
        outWriter.writeUTF(value);
        // Send the data to the Backup Manager via the BackupDataOutput 
        byte[] buffer = bufStream.toByteArray();
        int len = buffer.length;
        data.writeEntityHeader(ACCOUNTS_BACKUP_KEY, len);
        data.writeEntityData(buffer, len);
    } 
 
    /** 
     * Read data from the input stream 
     *  
     * @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);