Results 1 to 3 of 3
  1. #1
    ckannan90 is offline Member
    Join Date
    Aug 2010
    Rep Power

    Default Saving the contents of a variable to disk

    I am writing a program that is very computation intensive. I am taking a large number of images, analysing them, and saving the results to an array. This step takes a very long amount of time, especially for large images, so it would be good if there is some way for me to save this array to disk, so I can just reload the variable the next time I run it, instead of starting from scratch.

    I can do this fine with integer arrays, as I just write the numbers into a txt file and reload the next time. But I also have a File[] array, and I don't know how to save this one to disk. Any help? :(

  2. #2
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Destiny Islands
    Rep Power


    You cannot write an object array to anything. However, consider providing a unique piece of data (filename is the most obvious--and short filenames have no spaces, you know, PROGRA~1 and all that, so you can still tokenize from spaces), and saving that to the file instead.

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power


    also have a File[] array, and I don't know how to save this one to disk
    How about saving the full paths to the files to disk. That would allow you to reconstruct the File[] array from the filenames.

Similar Threads

  1. Issue with saving multiple times to a variable
    By sidd0123 in forum New To Java
    Replies: 3
    Last Post: 06-06-2010, 02:02 AM
  2. Replies: 1
    Last Post: 02-23-2010, 09:48 AM
  3. Replies: 3
    Last Post: 12-03-2009, 10:05 PM
  4. Getting disk label
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-05-2008, 09:07 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