Difficulties with using DataInputStream and DataOutputStream
Hello all,
I need help for understanding what I'm doing wrong here:
(pass and user are byte[] encrypted with RSA) the problem is that i can;t read what i wrote. :(
f =new DataOutputStream (new FileOutputStream("file.txt"));
f.write(pass);
f.write(user);
f.flush();
f.close();
System.out.println ("write pass"+pass);
System.out.println ("write user"+user);
f2 =new DataInputStream (new FileInputStream("file.txt"));
System.out.println("Available bytes"+f2.available());
byte [] ru =newbyte[64];
f2.read(ru,0,64);
byte [] rp =newbyte[64];
f2.read(rp);
f2.close();
System.out.println("read user"+ru);
System.out.println("read pass"+rp);
//output
write pass[B@2a4983
write user[B@406199
Available bytes128
read user[B@1b09468
read pass[B@1df5a8f

