This discussion is archived
4 Replies Latest reply: Jun 22, 2008 6:55 PM by 807601 RSS

How to Write A Binary File.

807601 Newbie
Currently Being Moderated
I am creating a program which will save data but i want this data to be encrypted/or unreadable.

I have created a simple console application which reads users input changes it into bytes and saves it to a file.
But its still saving it as readable text? any ideas?
               Scanner in = new Scanner(;
               FileOutputStream fos;
                    fos= new FileOutputStream(new File("data.txt"));
                    System.out.print("Enter String: ");          
                    String msg = in.nextLine();
                    byte[] wordInBytes = msg.getBytes();
               catch(Exception e)
Thank you for any help,