java-properties

Crates.iojava-properties
lib.rsjava-properties
version2.0.0
sourcesrc
created_at2016-01-29 03:31:54.887437
updated_at2023-05-21 03:26:29.074365
descriptionA library for reading and writing Java properties files in Rust.
homepage
repositoryhttps://github.com/adamcrume/java-properties
max_upload_size
id4010
size55,159
Adam Crume (adamcrume)

documentation

https://adamcrume.github.io/java-properties

README

Java properties for Rust

This is a library for reading and writing Java properties files in Rust. The specification is taken from the Properties documentation. Where the documentation is ambiguous or incomplete, behavior is based on the behavior of java.util.Properties.

Example

use std::collections::HashMap;
use std::env::temp_dir;
use std::fs::File;
use std::io::BufReader;
use std::io::BufWriter;
use std::io::prelude::*;

let mut file_name = temp_dir();
file_name.push("java-properties-test.properties");

// Writing
let mut map1 = HashMap::new();
map1.insert("a".to_string(), "b".to_string());
let mut f = File::create(&file_name)?;
write(BufWriter::new(f), &map1)?;

// Reading
let mut f = File::open(&file_name)?;
let map2 = read(BufReader::new(f))?;
assert_eq!(src_map1, dst_map1);
Commit count: 83

cargo fmt