1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
// DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE // Version 2, December 2004 // // Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> // // Everyone is permitted to copy and distribute verbatim or modified // copies of this license document, and changing it is allowed as long // as the name is changed. // // DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE // TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION // // 0. You just DO WHAT THE FUCK YOU WANT TO. // // Author: zadig <thomas chr(0x40) bailleux.me> //! A simple parser and reader for Microsoft Compound Document File. //! //! This includes a basic parser, which validates the format of a given file //! or a given stream. //! It includes a reader too, for iterating over entries and for extracting //! files inside the OLE storage. //! //! ## Example //! //! ``` //! //! use ole::OLEReader; //! use std::io::{Read, Write}; //! //! let mut file = std::fs::File::open("assets/Thumbs.db").unwrap(); //! let mut parser = OLEReader::new(file).unwrap(); //! //! // Iterate through the entries //! for entry in parser.iterate() { //! println!("{}", entry); //! } //! //! // We're going to extract a file from the OLE storage //! let entry = parser.iterate().next().unwrap(); //! let mut slice = parser.get_entry_slice(entry).unwrap(); //! let mut buffer = std::vec::Vec::<u8>::with_capacity(slice.len()); //! slice.read_to_end(&mut buffer); //! //! // Saves the extracted file //! let mut extracted_file = std::fs::File::create("./file.bin").unwrap(); //! extracted_file.write_all(&buffer[..]); //! ``` //! //! ## Compatibility //! //! The `ole` crate is tested for rust 1.9 or greater. mod ole; pub use ole::OLEReader; pub(crate) mod iterator; mod error; pub use error::OLEError; pub(crate) mod header; pub(crate) mod util; pub(crate) mod sat; pub(crate) mod constants; pub(crate) mod entry; pub use entry::OLEEntry; pub use entry::OLEEntrySlice; pub(crate) mod sector;