Results 1 to 3 of 3
  1. #1
    leshep is offline Member
    Join Date
    Nov 2009
    Posts
    2
    Rep Power
    0

    Default write/read two byte arrays to one file- help!

    i'm doing a java program, and i have to store two byte arrays to one file and read them back in another class, how can i do that? i know how to do it with one array using FileInputStream, the code as below:



    String KeyFilename="EncStrfile";
    File file = new File(KeyFilename);
    FileInputStream fis=new FileInputStream(file);
    byte[] enckeyarray=new byte[(int) file.length()];
    fis.read(enckeyarray);
    fis.close();



    but how can i store two byte arrays in one file and read them back??

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

  3. #3
    leshep is offline Member
    Join Date
    Nov 2009
    Posts
    2
    Rep Power
    0

    Default

    thanks alot! you gave me an idea, i'm new to Serialization, but i learned how to code it and it works! :)

Similar Threads

  1. [SOLVED] Read/Write to same XML file
    By Arsenic in forum XML
    Replies: 2
    Last Post: 05-12-2009, 12:51 AM
  2. Replies: 5
    Last Post: 02-05-2009, 10:28 AM
  3. Replies: 5
    Last Post: 01-20-2009, 09:08 AM
  4. Read and Write file
    By mrdestroy in forum New To Java
    Replies: 13
    Last Post: 10-31-2008, 12:11 PM
  5. File read/write problems
    By p900128 in forum New To Java
    Replies: 4
    Last Post: 06-27-2008, 12:15 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •