Writer out;try{ ByteArrayOutputStream byteOutput = new ByteArrayOutputStream(); new WalletProtobufSerializer().writeWallet(wallet, byteOutput); byteOutput.close(); byte[] plain = byteOutput.toByteArray();
String encrypted = Crypto.encrypt(plain);
out = new OutputStreamWriter(new FileOutputStream(backupFile), "UTF-8"); out.write(encrypted); out.flush();}catch (IOException e){ e.printStackTrace();}
BufferedReader buffreader;FileInputStream fIn;try{ StringBuffer datax = new StringBuffer(""); fIn = new FileInputStream(backupFile); InputStreamReader isr = new InputStreamReader(fIn); buffreader = new BufferedReader(isr); String readString = buffreader.readLine(); while (readString != null) { datax.append(readString); readString = buffreader.readLine(); }
byte[] decrypted = Crypto.decrypt(text.toString()); if (decrypted == null) return; else { InputStream inputStream = new ByteArrayInputStream(decrypted); Wallet wallet = new WalletProtobufSerializer().readWallet(inputStream); //ERROR IN THIS LINE inputStream.close();
//etc. }}catch (FileNotFoundException e){ e.printStackTrace();}catch (UnreadableWalletException e){ e.printStackTrace();}catch (IOException e){ e.printStackTrace();}
01-12 11:57:39.727: W/System.err(20751): org.bitcoinj.store.UnreadableWalletException: Could not parse input stream to protobuf01-12 11:57:39.727: W/System.err(20751): at org.bitcoinj.store.WalletProtobufSerializer.readWallet(WalletProtobufSerializer.java:391)...01-12 11:57:39.727: W/System.err(20751): Caused by: com.google.protobuf.InvalidProtocolBufferException: Protocol message contained an invalid tag (zero).01-12 11:57:39.732: W/System.err(20751): at com.google.protobuf.CodedInputStream.readTag(CodedInputStream.java:108)...
--
You received this message because you are subscribed to the Google Groups "bitcoinj" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bitcoinj+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.