public void flushWrites() { Assert.assertNotUiThread(); if (!this.saveQueue.isEmpty()) { FileOutputStream localFileOutputStream = null; try { localFileOutputStream = this.context.openFileOutput(this.path, 32768); DataOutputStream localDataOutputStream = new DataOutputStream(new BufferedOutputStream(localFileOutputStream)); int i = 0; int j = this.saveQueue.size(); while (i < j) { writeProto((MessageNano) this.saveQueue.get(i), localDataOutputStream); i++; } localDataOutputStream.flush(); logger.i("Saved " + this.saveQueue.size() + " proto(s) to disk.", new Object[0]); this.saveQueue.clear(); if (localFileOutputStream != null) ; try { localFileOutputStream.close(); return; } catch (IOException localIOException4) { logger.w("Could not close protos file after write.", new Object[] {localIOException4}); return; } } catch (IOException localIOException2) { do { logger.w("Could not write protos.", new Object[] {localIOException2}); this.saveQueue.clear(); } while (localFileOutputStream == null); try { localFileOutputStream.close(); return; } catch (IOException localIOException3) { logger.w("Could not close protos file after write.", new Object[] {localIOException3}); return; } } finally { this.saveQueue.clear(); if (localFileOutputStream == null) ; } try { localFileOutputStream.close(); throw localObject; } catch (IOException localIOException1) { while (true) logger.w("Could not close protos file after write.", new Object[] {localIOException1}); } } logger.i("No protos to save to disk.", new Object[0]); }
public List<T> read() { Assert.assertNotUiThread(); FileInputStream localFileInputStream = null; try { localFileInputStream = this.context.openFileInput(this.path); DataInputStream localDataInputStream = new DataInputStream(new BufferedInputStream(localFileInputStream)); localArrayList = new ArrayList(); int i = 1; while (i != 0) try { localArrayList.add(readProto(localDataInputStream)); } catch (EOFException localEOFException) { i = 0; } logger.i("Read " + localArrayList.size() + " persisted protos.", new Object[0]); if (localArrayList.isEmpty()) this.context.deleteFile(this.path); localArrayList.addAll(this.saveQueue); if (localFileInputStream != null) ; try { localFileInputStream.close(); return localArrayList; } catch (IOException localIOException4) { logger.w("Could not close file after read.", new Object[] {localIOException4}); return localArrayList; } } catch (IOException localIOException2) { ArrayList localArrayList; do { logger.d("Could not read protos from disk.", new Object[] {localIOException2}); this.context.deleteFile(this.path); localArrayList = new ArrayList(this.saveQueue); } while (localFileInputStream == null); try { localFileInputStream.close(); return localArrayList; } catch (IOException localIOException3) { logger.w("Could not close file after read.", new Object[] {localIOException3}); return localArrayList; } } finally { if (localFileInputStream == null) ; } try { localFileInputStream.close(); throw localObject; } catch (IOException localIOException1) { while (true) logger.w("Could not close file after read.", new Object[] {localIOException1}); } }
public int readAudioVolume(int paramInt) { try { int j = Integer.parseInt(this.audioManager.getParameters("earbuds_volume")); FormattingLogger localFormattingLogger2 = logger; Object[] arrayOfObject2 = new Object[1]; arrayOfObject2[0] = Integer.valueOf(j); localFormattingLogger2.d("Read volume from HAL: %s", arrayOfObject2); return j; } catch (NumberFormatException localNumberFormatException) { if (paramInt != 1) ; } for (int i = 9; ; i = 9) { FormattingLogger localFormattingLogger1 = logger; Object[] arrayOfObject1 = new Object[1]; arrayOfObject1[0] = Integer.valueOf(i); localFormattingLogger1.w( localNumberFormatException, "Could not read HAL volume, defaulting to: %s", arrayOfObject1); return i; } }