Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. private void restore() {
  2. File backupFolder = new File(getBackupFolder());
  3. if(!backupFolder.exists() || !backupFolder.isDirectory() ||
  4. !backupFolder.canWrite()){
  5. Log.w(TAG,
  6. backupFolder
  7. + " either does not exist or is not a directory or not writable!");
  8. }
  9.  
  10. ShellCommand sc = new ShellCommand();
  11. FileInputStream fis = null;
  12. FileOutputStream fos = null;
  13.  
  14. try{
  15. for(File font : backupFolder.listFiles()){
  16. if(font.isDirectory()){
  17. continue;
  18. }
  19. fis = new FileInputStream(font);
  20. fos = new FileOutputStream(new File("/system/fonts" + font.getName()));
  21. sc.su.run("mount -o remount, rw" + getSystemPartion() + "/system");
  22. IOUtils.copy(fis, fos);
  23. }
  24. }catch (Exception ex) {
  25. notifyUser(ex.getMessage());
  26. }finally{
  27. IOUtils.closeQuietly(fis);
  28. IOUtils.closeQuietly(fos);
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement