Efficient data logging for lots of data

Discussion in 'Plugin Development' started by FireBreath14, Aug 12, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    FireBreath14

    I need a way to store mass amounts of data to a file efficiently. I am currently using YAML and it causes servers to lag because the plugin is storing so much data (block breaks, basically). I am wondering if there is a library or some piece of code that I could use to store data in a fast, efficient way. I also don't want the server owner to be able to open the file (although thats not a deal breaker for me).

    If anyone has tips and/or libraries I could use, I'd appreciate it!
     
  2. Offline

    Assist

  3. Offline

    FireBreath14

    I have no idea how to use one though. Is there a tutorial on it somewhere?
     
  4. Offline

    Assist

  5. Offline

    Pllar7680

    Hello,
    The natural way to do this in Java is to create a very simple Recipe class, with the ingredients and description as instance variables. You can then write or read a whole Recipe to/from an ObjectOutputStream/ObjectInputStream with a single method call. Alternatively, to use a text file, use the java.beans.XMLEncoder class to write your Recipe to an XML encoded text file, and java.beans.XMLDecoder to read the file back into a Recipe object, also with a single line of code.
    If you follow either of these routes you can also create an ArrayList<Recipe> to hold a number of Recipes, and write/read the whole ArrayList with a single line of code.
    Hope this helps you, or you can read this article fo rdata mangement.
    Regards
    --
     
Thread Status:
Not open for further replies.

Share This Page