📄
Object Data Structure
  • Object Data Structure
  • usage
    • Getting Started
    • Using Tags
  • Format
    • Specification
    • Compression Types
Powered by GitBook
On this page
  • File vs Memory Mode
  • The ObjectDataStructure Class

Was this helpful?

  1. usage

Getting Started

Object Data Structure has two different modes. Learn about them here.

Welcome to Object Data Structure! Most implementations of ODS are very similar to each other with minor differences.

All implementations of ODS have an ObjectDataStructure class. This class allows you to define what you want to do with ODS. ODS allows you to save/load from file or memory.

File vs Memory Mode

ODS has two modes that you can pick from that determines how ODS handles data. Those two modes are File and Memory modes.

File Mode

When ODS is in file mode, all data is written to and read from a file. You have the option to compress that file to make the space used up on the hard drive lower. Note: When compression is used, the entire file must be read due to the nature of compression algorithms.

When in File Mode no memory is cached at all and all operations read/write the file directly. If this is an issue, than it is recommended to use Memory Mode as it has options to export the data to a file (also with compression).

Memory Mode

Memory Mode is considered to be more efficient than File Mode since all operations are done on an internal buffer instead of on a hard drive. This is probably the best general purpose mode to use when working with ODS.

Both Modes

Both modes support exporting bytes to memory and a file. These export methods also allows you to define a compression algorithm to use.

The ObjectDataStructure Class

In order to use the basic functionality of ODS you need to import (or use) the classes/structs required by ODS.

import me.ryandw11.ods;
using ODS;
use object_data_structure::ods::{ObjectDataStructure};

As stated above, in all implementation you must construct an ObjectDataStructure object in order to use ODS. You can have multiple ObjectDataStructures going at once.

The ObjectDataStructure class should only be used on a single thread to prevent IO conflicts. It is recommended to use a thread separate from the main one if in File Mode.

In Java you can pick between the different constructors to determine file vs memory.

For File Mode:

 ObjectDataStructure ods = new ObjectDataStructure(new File("test.ods"));

For Memory Mode:

ObjectDataStructure ods = new ObjectDataStructure();

In C# you can pick between the different constructors to determine file vs memory.

For File Mode

FileInfo file = new FileInfo(Directory.GetCurrentDirectory() + "\\file.ods");
ObjectDataStructure ods = new ObjectDataStructure(file);

For Memory Mode:

ObjectDataStructure ods = new ObjectDataStructure();

In Rust you can pick between the different methods to determine file vs memory.

For File Mode:

use std::path::PathBuf;

let mut ods = ObjectDataStructure::new_file(PathBuf::from("./file.ods"));

For Memory Mode:

Memory Mode is currently not implemented in ODS for Rust. Please check back in a future version.

Now you are ready to save or load data from a file. We will be covering Creating and Saving tags next.

PreviousObject Data StructureNextUsing Tags

Last updated 3 years ago

Was this helpful?

You can see the different constructor in the .

JavaDocs