How does a Java application using no database , stores previous information and displays it

StackOverflow https://stackoverflow.com/questions/23277049

  •  09-07-2023
  •  | 
  •  

Domanda

I have this java application project(client) based on peer to peer file sharing system. It doesn't use any kind of database.

There's a Download tab which shows the names of previously downloaded files as well as currently downloading file too.

What I don't understand is that where this information is getting stored and retrieved from. Every time I close and reopen the application , The information of previous downloads is there.

Also, it stores the IP addresses of the previously connected hosts and shows them in a tab.

I checked that there isn't any flat file, db file or log file in the project folder. There are 150 files of code so i really cant go through it and find out.

Sorry if the question is too naive but if anybody have even a single clue then please do comment.

edit : I found this bit of code

    public void saveDownloadInfo()
        throws IOException
{
    FileOutputStream    fos = new FileOutputStream(ServiceManager.getDownloadSaveFilename());
    ObjectOutputStream  oos = new ObjectOutputStream(fos);

    try
    {
        // Use latest version to serialize.
        serialize1(oos);
    }
    finally
    {
        oos.close();
    }
}


public void loadDownloadInfo()
        throws Exception
{
    FileInputStream     fis = new FileInputStream(ServiceManager.getDownloadSaveFilename());
    ObjectInputStream   ois = new ObjectInputStream(fis);

Still not able to track where it's getting stored.

È stato utile?

Soluzione

Maybe it is just using the filesystem as the database. For example, if it knows all the files it downloads are to a specific folder, then it just scans that folder for previously downloaded files.

Edit: After reading that this application also stores IP Addresses, then either this information must be stored locally or remotely in some fashion. If you are certain it is not stored locally, then the only answer is that this information is retrieved from the server using a unique client identifier such as a session cookie, ip address, or a unique id baked into the application client.

Altri suggerimenti

There's a class called Preferences which stores this kind of information in an OS-dependent way. For Windows, it stores it in the Windows registry. On other OSs, there may be some kind of flat file in a "special" location. It is probably what your application is using.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top