ui/ui/src/main/java/com/squareup/subzero/wallet/WalletLoader.java
public void save(int walletId, Wallet wallet) throws IOException {
    Path path = getWalletPath(walletId);
    System.out.println(format("Saving wallet file to: %s", path));
    FileOutputStream fos = new FileOutputStream(path.toFile());
    OutputStreamWriter osw = new OutputStreamWriter(fos, UTF_8);

    // We save the wallet in JSON format, because it's simpler if we need to fix anything manually.
    JsonFormat.print(wallet, osw);
    osw.flush();
    fos.getFD().sync();

    // TODO: save to USB backup drive
  }
/**
   * Saves wallet and calls fsync to ensure the OS flushes its disk cache.
   */
Saves wallet and calls fsync to ensure the OS flushes its disk cache.
Saves wallet and calls fsync to ensure the OS flushes its disk cache .
public void save(int walletId, Wallet wallet) throws IOException {
    Path path = getWalletPath(walletId);
    System.out.println(format("Saving wallet file to: %s", path));
    FileOutputStream fos = new FileOutputStream(path.toFile());
    OutputStreamWriter osw = new OutputStreamWriter(fos, UTF_8);
    JsonFormat.print(wallet, osw);
    osw.flush();
    fos.getFD().sync();
  }
public void save ( int walletId , Wallet wallet ) throws IOException { Path path = getWalletPath ( walletId ) ; System . out . println ( format ( "Saving wallet file to: %s" , path ) ) ; FileOutputStream fos = new FileOutputStream ( path . toFile ( ) ) ; OutputStreamWriter osw = new OutputStreamWriter ( fos , UTF_8 ) ; JsonFormat . print ( wallet , osw ) ; osw . flush ( ) ; fos . getFD ( ) . sync ( ) ; }
Saves wallet and calls fsync to ensure the OS flushes its disk cache.
Saves wallet and calls fsync to ensure the OS flushes its disk cache .
// We save the wallet in JSON format, because it's simpler if we need to fix anything manually. // TODO: save to USB backup drive