private void writeKeys(@Nonnull final OutputStream os) throws IOException { final List<ECKey> keys = new LinkedList<ECKey>(); for (final ECKey key : wallet.getKeys()) if (!wallet.isKeyRotating(key)) keys.add(key); final Writer out = new OutputStreamWriter(os, Constants.UTF_8); WalletUtils.writeKeys(out, keys); out.close(); }
private static Wallet readKeys(@Nonnull final InputStream is) throws IOException { final BufferedReader in = new BufferedReader(new InputStreamReader(is, Constants.UTF_8)); final List<ECKey> keys = WalletUtils.readKeys(in); in.close(); final Wallet wallet = new Wallet(Constants.NETWORK_PARAMETERS); for (final ECKey key : keys) wallet.addKey(key); return wallet; }